modify GitHub action #14
Workflow file for this run
This file contains 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
name: release | |
on: | |
push: | |
# Pattern matched against refs/tags | |
tags: | |
- '**' # Push events to every tag including hierarchical tags like v1.0/beta | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
contents: write | |
attestations: write | |
runs-on: ubuntu-latest | |
env: | |
projName: webui | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install packages | |
run: npm install | |
- name: Build project | |
run: npm run build | |
- name: Create assets | |
uses: vimtor/[email protected] | |
with: | |
files: dist/ | |
dest: ${{ env.projName }}.zip | |
- name: Calc sha256sum | |
run: | | |
pkg="${projName}.zip" | |
hash="$(sha256sum ${pkg} | awk '{ print $1 }')" | |
echo CHECKSUM="${hash}" >> "$GITHUB_ENV" | |
echo "${pkg} sha256: ${hash}" >> "$GITHUB_STEP_SUMMARY" | |
- name: Attest | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: "${{ env.projName }}.zip" | |
- name: Publish Release | |
uses: ncipollo/[email protected] | |
with: | |
name: "v${{ github.ref_name }}" | |
body: | | |
#### 变化: | |
* 变化1 | |
#### SHA256: | |
${{ env.projName }}.zip (${{ env.CHECKSUM }}) | |
draft: true | |
prerelease: false | |
artifacts: "${{ env.projName }}.zip" |