Skip to content

fix: hotfix automatic build shared library ci (#127) #35

fix: hotfix automatic build shared library ci (#127)

fix: hotfix automatic build shared library ci (#127) #35

Workflow file for this run

name: Release
on:
push:
branches:
- main
- hotfix**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
get-version: # emit package version using `cargo tree -i`
name: Get Package Version
runs-on: ubuntu-latest
outputs:
package-version: ${{ steps.get-package-version.outputs.version }}
latest-tag: ${{ steps.get-latest-tag.outputs.tag }}
steps:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Get latest tag
id: get-latest-tag
uses: actions-ecosystem/action-get-latest-tag@v1
- name: Get package version
id: get-package-version
working-directory: ./libwasmvm
run: |
VERSION=$(cargo tree -i wasmvm | grep -oE "[0-9]+(\.[0-9]+){2}-[0-9]+(\.[0-9]+){2}(-[0-9a-zA-Z.]+)*(\+[0-9a-zA-Z.\-]+)*")
echo ::set-output name=version::v$VERSION
push-tag: # if the version does not exist as git tag, push it
name: Push Tag
needs:
- get-version
if: ${{ needs.get-version.outputs.package-version != needs.get-version.outputs.latest-tag }}
runs-on: ubuntu-latest
steps:
- name: Push Tag to GitHub
run: |
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
-d "{\"ref\": \"refs/tags/${{ needs.get-version.outputs.package-version }}\", \"sha\": \"${GITHUB_SHA}\"}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs"
update-releases:
name: Update releases
needs:
- get-version
- push-tag
if: ${{ needs.get-version.outputs.package-version != needs.get-version.outputs.latest-tag }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: set up
uses: actions/setup-go@v3.2.1
with:
go-version: '1.20'
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Build docker image
run: cd builders && make docker-image-alpine && make docker-image-cross
- name: Build & Test static library
run: make release-build-alpine
- name: Build static library for MacOS
run: make release-build-macos-static
- name: Collect artifacts
run: |
mkdir artifacts
cp ./internal/api/libwasmvm_muslc.a ./artifacts/libwasmvm_muslc.x86_64.a
cp ./internal/api/libwasmvm_muslc.aarch64.a ./artifacts/libwasmvm_muslc.aarch64.a
cp ./internal/api/libwasmvmstatic_darwin.a ./artifacts/libwasmvmstatic_darwin.a
- name: Create checksums
working-directory: ./artifacts
run: sha256sum * > checksums.txt && cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v0.1.13
with:
tag_name: ${{ needs.get-version.outputs.package-version }}
body: ${{ github.event.pull_request.body }}
files: |
./artifacts/*
draft: false
prerelease: false