Skip to content

Commit

Permalink
Add automated release artifacts for tags
Browse files Browse the repository at this point in the history
This commit adds builds for tag pushes. Instead of uploading a single
build ZIP to the actions result, it:
- Creates a new draft GitHub release with GitHub's own automatically-
  generated release notes.
- Marks the release as a prerelease if it includes `-pre` or starts with
  `v0`.
- Attaches each release ZIP to the release as an artifact.
  • Loading branch information
Shadowfiend committed Mar 24, 2022
1 parent 0b33800 commit 780d6d4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- main
tags:
- v*

jobs:
build:
Expand All @@ -23,23 +25,32 @@ jobs:
cache: "yarn"
- run: yarn install --frozen-lockfile
- name: Dev build
if: github.ref != 'refs/heads/main' && !startsWith(github.head_ref, 'release-')
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
run: yarn build
env:
ALCHEMY_KEY: ${{ secrets.DEV_ALCHEMY_API_KEY || 'oV1Rtjh61hGa97X2MTqMY9kEUcpxP-6K' }}
BLOCKNATIVE_API_KEY: ${{ secrets.DEV_BLOCKNATIVE_API_KEY || 'f60816ff-da02-463f-87a6-67a09c6d53fa' }}
- name: Production build
if: github.ref == 'refs/heads/main' || startsWith(github.head_ref, 'release-')
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
run: yarn build
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_API_KEY }}
BLOCKNATIVE_API_KEY: ${{ secrets.BLOCKNATIVE_API_KEY }}
ZEROX_API_KEY: ${{ secrets.ZEROX_API_KEY }}
- name: Upload build asset
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v2
with:
name: extension-builds
path: dist/*.zip
- name: Create Release and Upload Artifacts
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*.zip
draft: true
generate_release_notes: true
prerelease: ${{ contains(github.ref, '-pre') || contains(github.ref, 'v0.') }}
test:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 780d6d4

Please sign in to comment.