Last active
February 16, 2025 19:16
-
-
Save frozer/7a4bbbfca69ae3a4feaf214df5b6cd68 to your computer and use it in GitHub Desktop.
Github Actions - Push a new release, automated release notes, build artifacts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
env: | |
project_name: PROJECT NAME USED IN RELEASE TITLE | |
artifact_package_name: PACKAGE_NAME, used as "package-name-%TAG%.tar.gz" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Save tag as env variable | |
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Store artifact package name as env variable | |
run: echo ARTIFACT_NAME=${{ env.artifact_package_name }}-${{ env.TAG_NAME }}-bundle.tar.gz >> $GITHUB_ENV | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: | | |
# FIXME yarn install --immutable --check-cache | |
# FIXME npx nuxt build | |
git log $(git describe --abbrev=0 --tags ${{ env.TAG_NAME }}^)..${{ env.TAG_NAME }} --pretty=format:"%h %s by %an" > .output/CHANGELOG.md | |
- name: Pack build artifacts | |
run: > | |
tar zcvf ${{ env.ARTIFACT_NAME }} -C .output ./ | |
- name: Create Release | |
run: gh release create ${{ github.ref_name }} ${{ env.ARTIFACT_NAME }} --title "Release ${{ github.ref_name }}" --notes-file .output/CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment