Fixed publish script (https://github.com/hyperifyio/project-govm/issu… #1
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: Go Build and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} for ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
outputs: | |
submodule_commit: ${{ steps.submodule_commit.outputs.SUBMODULE_COMMIT }} | |
strategy: | |
matrix: | |
os: [linux, darwin, windows] | |
arch: [amd64, arm64, 386, mips, mips64, mips64le, mipsle, ppc64, ppc64le, riscv64, s390x] | |
exclude: | |
- os: darwin | |
arch: 386 | |
- os: darwin | |
arch: mips | |
- os: darwin | |
arch: mips64 | |
- os: darwin | |
arch: mips64le | |
- os: darwin | |
arch: mipsle | |
- os: darwin | |
arch: ppc64 | |
- os: darwin | |
arch: ppc64le | |
- os: darwin | |
arch: riscv64 | |
- os: darwin | |
arch: s390x | |
- os: windows | |
arch: mips64 | |
- os: windows | |
arch: mips64le | |
- os: windows | |
arch: mipsle | |
- os: windows | |
arch: mips | |
- os: windows | |
arch: ppc64 | |
- os: windows | |
arch: ppc64le | |
- os: windows | |
arch: riscv64 | |
- os: windows | |
arch: s390x | |
steps: | |
- name: Extract Tag Name | |
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set Submodule Commit SHA as commitish | |
id: submodule_commit | |
run: echo "SUBMODULE_COMMIT=$(git -C internal/frontend/project-govm rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Download and Unpack goselfshield Binary | |
run: | | |
URL="https://github.com/hyperifyio/goselfshield/releases/download/v0.0.2/goselfshield-v0.0.2-linux-amd64.zip" | |
curl -L $URL -o goselfshield.zip | |
unzip goselfshield.zip | |
chmod +x goselfshield-v0.0.2-linux-amd64/goselfshield | |
sudo mv goselfshield-v0.0.2-linux-amd64/goselfshield /usr/local/bin/ | |
- name: Build | |
run: | | |
make build GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} VERSION=${{ env.TAG_NAME }} | |
- name: Install Syft | |
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | |
- name: Generate SBOM | |
run: syft govm -o text > NOTICE | |
- name: Prepare Artifacts | |
run: | | |
mkdir govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }} | |
CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} goselfshield --private-key ${{ secrets.RELEASE_PRIVATE_KEY }} -source govm -output govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}/govm | |
cp README.release.md govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}/README | |
cp LICENSE.md govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}/LICENSE | |
cp -r etc govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}/etc/ | |
zip -r govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }} | |
path: govm-${{ env.TAG_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set MIT LICENSE Date | |
run: echo "MIT_DATE=$(date -d "+2 years" +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Extract Tag Name | |
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV | |
- name: Set Current Date | |
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: govm-v* | |
- name: Create Private Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} / ${{ env.CURRENT_DATE }} | |
draft: false | |
prerelease: false | |
body: | | |
Notice! This release contains the release as an encrypted self-installer executable. You will need a private key to use it, which we'll provide after purchase. | |
This release is provided under **Functional Source License, Version 1.1, MIT Future License**. | |
For other commercial license options before **${{ env.MIT_DATE }}**, please contact us at [info@sendanor.fi](mailto:info@sendanor.fi) or visit our [website](https://www.sendanor.fi). | |
Please refer to [the full license text](https://github.com/hyperifyio/project-govm/blob/main/LICENSE.md) for detailed terms and conditions. | |
- name: Upload Private Release Assets | |
run: | | |
for os in linux darwin windows; do | |
for arch in amd64 arm64 386 mips mips64 mips64le mipsle ppc64 ppc64le riscv64 s390x; do | |
upload_url=$(echo "${{ steps.create_release.outputs.upload_url }}" | sed -re 's@/assets([?{][^\/]*)$@/assets@') | |
file="govm-${{ env.TAG_NAME }}-$os-$arch/govm-${{ env.TAG_NAME }}-$os-$arch.zip" | |
if [ -f "$file" ]; then | |
echo | |
echo "Uploading $file" | |
echo '------------------------------' | |
curl -L \ | |
-X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Content-Type: application/octet-stream" \ | |
--data-binary @"$file" \ | |
"$upload_url?name=$(basename $file)" | |
echo '------------------------------' | |
else | |
echo "$file not found, skipping..." | |
fi | |
done | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Public Release | |
id: create_public_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} / ${{ env.CURRENT_DATE }} | |
commitish: ${{ needs.build.outputs.submodule_commit }} | |
owner: hyperifyio | |
repo: project-govm | |
draft: false | |
prerelease: false | |
body: | | |
Notice! This release contains the release as an encrypted self-installer executable. You will need a private key to use it, which we'll provide after purchase. | |
This release is provided under **Functional Source License, Version 1.1, MIT Future License**. | |
For other commercial license options before **${{ env.MIT_DATE }}**, please contact us at [info@sendanor.fi](mailto:info@sendanor.fi) or visit our [website](https://www.sendanor.fi). | |
Please refer to [the full license text](https://github.com/hyperifyio/project-govm/blob/main/LICENSE.md) for detailed terms and conditions. | |
- name: Upload Public Release Assets | |
run: | | |
for os in linux darwin windows; do | |
for arch in amd64 arm64 386 mips mips64 mips64le mipsle ppc64 ppc64le riscv64 s390x; do | |
upload_url=$(echo "${{ steps.create_public_release.outputs.upload_url }}" | sed -re 's@/assets([?{][^\/]*)$@/assets@') | |
file="govm-${{ env.TAG_NAME }}-$os-$arch/govm-${{ env.TAG_NAME }}-$os-$arch.zip" | |
if [ -f "$file" ]; then | |
echo | |
echo "Uploading $file" | |
echo '------------------------------' | |
curl -L \ | |
-X POST \ | |
-H "Authorization: Bearer ${{ secrets.RELEASE_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Content-Type: application/octet-stream" \ | |
--data-binary @"$file" \ | |
"$upload_url?name=$(basename $file)" | |
echo '------------------------------' | |
else | |
echo "$file not found, skipping..." | |
fi | |
done | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} |