A few years ago, I posted the article about setting up Release with Travis CI.
Now, Github Action more and more popular, I used the that on my new project, aim to same goal.
github action config
name: new-release
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
create-release:
name: create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install dependencies
run: |
node -v
npm -v
pnpm -v
npm install -g yarn
yarn -v
yarn install
- name: yarn build
run: |
yarn build
ls -l ./dist
- name: zip asset
run: |
mv ./dist x-wallet
zip -q -r x-wallet.zip x-wallet # zip --junk-paths
shasum -a 256 x-wallet.zip | tee x-wallet.asc
- name: create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release:
draft: false
prerelease: false
- name: upload release asset 1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./x-wallet.zip
asset_name: x-wallet.zip
asset_content_type: application/zip
- name: upload release asset 2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./x-wallet.asc
asset_name: x-wallet.asc
asset_content_type: application/txt
Ref: