diff --git a/.github/scripts/upload_s3.sh b/.github/scripts/upload_s3.sh new file mode 100644 index 0000000..11d5e74 --- /dev/null +++ b/.github/scripts/upload_s3.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +aws configure --profile s3 <<-EOF > /dev/null 2>&1 +${S3_ACCESS_KEY_ID} +${S3_SECRET_ACCESS_KEY} +auto +text +EOF + +VERSION=$(git describe --tags || echo "unknown version") +aws s3 cp bin s3://$S3_BUCKET/$VERSION/ --profile s3 --no-progress --endpoint-url $S3_ENDPOINT --recursive + +aws configure --profile s3 <<-EOF > /dev/null 2>&1 +null +null +null +text +EOF diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml index da62b6f..84ba6a2 100644 --- a/.github/workflows/go-release.yml +++ b/.github/workflows/go-release.yml @@ -7,6 +7,7 @@ jobs: release-binary: name: Release Binary runs-on: ubuntu-latest + environment: s3 steps: - name: Setup Go uses: actions/setup-go@v3 @@ -51,6 +52,15 @@ jobs: name: build path: bin + - name: Upload to s3 + if: startsWith(github.ref, 'refs/tags/') + run: sh .github/scripts/upload_s3.sh + env: + S3_BUCKET: ${{ secrets.S3_BUCKET }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + release-aur-bin: name: Release Aur bin needs: [release-binary]