From b721a17e0e5c409c76ffbfc43e49c37bfc4ff031 Mon Sep 17 00:00:00 2001 From: Pratikkumar Mohite Date: Sat, 31 Aug 2024 18:06:11 +0530 Subject: [PATCH 1/2] added release github action --- .github/workflows/release.yaml | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..e8a3c01 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,63 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.22.5' + + - name: Build + run: | + make build + + - name: Read Release Notes + id: read_release_notes + run: | + release_notes_file="release/${GITHUB_REF_NAME}.md" + + if [ -f "$release_notes_file" ]; then + release_notes=$(cat "$release_notes_file") + else + echo "Release notes file $release_notes_file not found." + exit 1 + fi + + echo "RELEASE_NOTES<> $GITHUB_ENV + echo "$release_notes" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + body: ${{ env.RELEASE_NOTES }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./s3-cleanup + asset_name: s3-cleanup + asset_content_type: application/octet-stream From 496bfb4f751a195eee5cd16d2e7a666c41e323a1 Mon Sep 17 00:00:00 2001 From: Pratikkumar Mohite Date: Sat, 31 Aug 2024 18:11:00 +0530 Subject: [PATCH 2/2] updated the secret --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e8a3c01..9fc3a6d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,7 +44,7 @@ jobs: id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_CI_TOKEN }} with: tag_name: ${{ github.ref_name }} release_name: Release ${{ github.ref_name }} @@ -55,7 +55,7 @@ jobs: - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_CI_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./s3-cleanup