Skip to content

Build and Package

Build and Package #118

name: Build and Package
on:
push:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
permissions:
contents: write
actions: read
jobs:
build:
name: Build and Package
concurrency:
group: production-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install wasm-pack
uses: qmaru/wasm-pack-action@v0.5.0
- name: npm install and build
run: |
npm ci
npm run build
env:
CI: true
- name: Prepare artifact
run: |
mkdir artifact
rsync -av --exclude-from=.distignore . artifact/
- name: Package
uses: actions/upload-artifact@v4
with:
name: rust-starter
path: artifact
retention-days: 3
if-no-files-found: error
compression-level: 0
- name: Update README
if: github.ref == 'refs/heads/main'
run: |
artifact_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
sed -i '/\[Latest Build\]/d' README.md
echo -e "\n[Latest Build]($artifact_url)" >> README.md
- name: Commit changes
if: github.ref == 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update README with latest build link
file_pattern: 'README.md'