Skip to content

Build and Release Artifacts #25

Build and Release Artifacts

Build and Release Artifacts #25

Workflow file for this run

name: Build and Release Artifacts
permissions:
contents: write
packages: write
on:
push:
tags:
- "*"
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
- name: Build flake package
run: nix build
- name: Copy Built Result
run: |
mkdir -p ${{ github.workspace }}/artifacts
cp -r ./result/bin/mms ${{ github.workspace }}/artifacts
- name: Build wasm
run: nix build ".#wasm"
- name: Publish built wasm package
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./result/js
npm publish --access public
# - name: Copy wasm Result
# run: |
# cp -r ./result/main.wasm ${{ github.workspace }}/artifacts/mms.wasm
# cp -r ./result/wasm_exec.js ${{ github.workspace }}/artifacts/go_wasm_loader.js
- name: Get tag name
id: get_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_tag.outputs.tag }}
files: ${{ github.workspace }}/artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger UI Update
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/MinecraftMetascript/ui/dispatches \
-d '{"event_type":"mms_release"}'