ci: GH release job in response to tag creations (#1186)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
75
.github/workflows/release.yaml
vendored
75
.github/workflows/release.yaml
vendored
@@ -8,12 +8,7 @@ on:
|
||||
- 'netlify.toml'
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore: # ignore docs as they are built with Netlify.
|
||||
- '**/*.md'
|
||||
- 'site/**'
|
||||
- 'netlify.toml'
|
||||
|
||||
# TODO: add tag trigger
|
||||
tags: 'v[0-9]+.[0-9]+.[0-9]+**' # Ex. v0.2.0 v0.2.1-rc2
|
||||
|
||||
env: # Update this prior to requiring a higher minor version in go.mod
|
||||
GO_VERSION: "1.20" # 1.xx == latest patch of 1.xx
|
||||
@@ -32,6 +27,9 @@ jobs:
|
||||
name: Pre-release build
|
||||
# This only runs on ubuntu so that we can simplify the installation of necessary toolchain to build artifacts.
|
||||
runs-on: ubuntu-22.04
|
||||
# This allows us to test in the following job regardless of the event (tag or not).
|
||||
outputs:
|
||||
VERSION: ${{ steps.output-version.outputs.VERSION }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -56,11 +54,29 @@ jobs:
|
||||
echo ${{ secrets.WINDOWS_CODESIGN_P12_BASE64 }} | base64 --decode > windows-certificate.p12
|
||||
echo "WINDOWS_CODESIGN_P12=windows-certificate.p12" >> $GITHUB_ENV
|
||||
|
||||
- name: Make artifacts
|
||||
- name: Make artifacts (test)
|
||||
if: github.event_name != 'push' || !contains(github.ref, 'refs/tags/')
|
||||
env:
|
||||
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
|
||||
run: | # Checks artifacts are buildable.
|
||||
make dist VERSION=${{ github.sha }}
|
||||
run: |
|
||||
VERSION=${{ github.sha }}
|
||||
make dist VERSION=$VERSION
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- name: Make artifacts
|
||||
# Triggers only on tag creation.
|
||||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||
env:
|
||||
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
|
||||
run: | # Note: MSI_VERSION requires . as a separator, so replace "-" in the tag with ".".
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
MSI_VERSION=${VERSION//-/.}
|
||||
make dist VERSION=$VERSION MSI_VERSION=$MSI_VERSION
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
|
||||
# This allows us to test in the following job regardless of the event (tag or not).
|
||||
- id: output-version
|
||||
run: echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# In order to share the built artifacts in the subsequent tests, we use cache instead of actions/upload-artifacts.
|
||||
# The reason is that upload-artifacts are not globally consistent and sometimes pre_release_test won't be able to
|
||||
@@ -73,7 +89,7 @@ jobs:
|
||||
with:
|
||||
# Use share the cache containing archives across OSes.
|
||||
enableCrossOsArchive: true
|
||||
# Note: this creates a cache per run. we delete the post tests.
|
||||
# Note: this creates a cache per run.
|
||||
key: release-artifacts-${{ github.run_id }}
|
||||
path:
|
||||
dist/
|
||||
@@ -105,22 +121,22 @@ jobs:
|
||||
# Check if the version was correctly inserted with VERSION variable
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
tar xf dist/wazero_${{ github.sha }}_linux_amd64.tar.gz
|
||||
./wazero version | grep ${{ github.sha }}
|
||||
tar xf dist/wazero_${{ needs.pre_release.outputs.VERSION }}_linux_amd64.tar.gz
|
||||
./wazero version | grep ${{ needs.pre_release.outputs.VERSION }}
|
||||
|
||||
- name: Test (darwin)
|
||||
# Check if the version was correctly inserted with VERSION variable
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
tar xf dist/wazero_${{ github.sha }}_darwin_amd64.tar.gz
|
||||
./wazero version | grep ${{ github.sha }}
|
||||
tar xf dist/wazero_${{ needs.pre_release.outputs.VERSION }}_darwin_amd64.tar.gz
|
||||
./wazero version | grep ${{ needs.pre_release.outputs.VERSION }}
|
||||
|
||||
# This only checks the installer when built on Windows as it is simpler than switching OS.
|
||||
# refreshenv is from choco, and lets you reload ENV variables (used here for PATH).
|
||||
- name: Test Windows Installer
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
set MSI_FILE="dist\wazero_${{ github.sha }}_windows_amd64.msi"
|
||||
set MSI_FILE="dist\wazero_${{ needs.pre_release.outputs.VERSION }}_windows_amd64.msi"
|
||||
call packaging\msi\verify_msi.cmd
|
||||
shell: cmd
|
||||
|
||||
@@ -129,7 +145,32 @@ jobs:
|
||||
- name: Test winget manifest generation
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
./packaging/msi/winget_manifest.sh ${{ github.sha }} "dist\wazero_${{ github.sha }}_windows_amd64.msi" > Tetrate.wazero.yaml
|
||||
./packaging/msi/winget_manifest.sh ${{ needs.pre_release.outputs.VERSION }} "dist\wazero_${{ needs.pre_release.outputs.VERSION }}_windows_amd64.msi" > Tetrate.wazero.yaml
|
||||
yamllint -sd '{extends: default, rules: {line-length: disable}}' Tetrate.wazero.yaml
|
||||
|
||||
# TODO: release creation job depending on pre_release_test, which is only run on tag creation event.
|
||||
# Triggers only on the tag creation.
|
||||
release:
|
||||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||
needs: pre_release_test
|
||||
name: Release
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
fail-on-cache-miss: true
|
||||
enableCrossOsArchive: true
|
||||
key: release-artifacts-${{ github.run_id }}
|
||||
path:
|
||||
dist/
|
||||
|
||||
- name: Create draft release
|
||||
run: |
|
||||
ls dist
|
||||
tag="${GITHUB_REF#refs/tags/}"
|
||||
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
|
||||
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./dist/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
39
.github/workflows/release_notes.sh
vendored
Executable file
39
.github/workflows/release_notes.sh
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh -ue
|
||||
#
|
||||
# This script generates the release notes "wazero" for a specific release tag.
|
||||
# .github/workflows/release_notes.sh v1.3.0
|
||||
|
||||
tag=$1
|
||||
prior_tag=$(git tag -l 'v*'|sed "/${tag}/,+10d"|tail -1)
|
||||
if [ -n "${prior_tag}" ]; then
|
||||
range="${prior_tag}..${tag}"
|
||||
else
|
||||
range=${tag}
|
||||
fi
|
||||
|
||||
git config log.mailmap true
|
||||
changelog=$(git log --format='%h %s %aN, %(trailers:key=co-authored-by)' "${range}")
|
||||
|
||||
# strip the v off the tag name more shell portable than ${tag:1}
|
||||
version=$(echo "${tag}" | cut -c2-100) || exit 1
|
||||
cat <<EOF
|
||||
wazero ${version} supports X and Y and notably fixes Z
|
||||
|
||||
TODO: classify the below into up to 4 major headings and the rest as bulleted items in minor changes
|
||||
The published release notes should only include the summary statement in this section.
|
||||
|
||||
${changelog}
|
||||
|
||||
## X packages
|
||||
|
||||
Don't forget to cite who was involved and why
|
||||
|
||||
## wazero Y
|
||||
|
||||
## Minor changes
|
||||
|
||||
TODO: don't add trivial things like fixing spaces or non-concerns like build glitches
|
||||
|
||||
* Z is now fixed thanks to Yogi Bear
|
||||
|
||||
EOF
|
||||
9
Makefile
9
Makefile
@@ -262,11 +262,12 @@ fuzz:
|
||||
#### CLI release related ####
|
||||
|
||||
VERSION ?= dev
|
||||
# Default to a dummy version 0.0.1, which is always lower than a real release.
|
||||
# This must be in the form of [0-255].[0-255].[0-65535] as opposed to VERSION which can be arbitrary.
|
||||
# Default to a dummy version 0.0.1.rc1, which is always lower than a real release.
|
||||
# This must be in the form of [0-255].[0-255].[0-65535] plus optional fourth element which will be ignored.
|
||||
# We use the fourth field to represent the rc portion of release tag (e.g. rc1 of 1.0.0-rc2).
|
||||
# https://learn.microsoft.com/en-us/windows/win32/msi/productversion?redirectedfrom=MSDN
|
||||
# https://stackoverflow.com/questions/9312221/msi-version-numbers
|
||||
MIS_VERSION ?= 0.0.1
|
||||
MSI_VERSION ?= 0.0.1.rc1
|
||||
non_windows_platforms := darwin_amd64 darwin_arm64 linux_amd64 linux_arm64
|
||||
non_windows_archives := $(non_windows_platforms:%=dist/wazero_$(VERSION)_%.tar.gz)
|
||||
windows_platforms := windows_amd64 # TODO: add arm64 windows once we start testing on it.
|
||||
@@ -328,7 +329,7 @@ endef
|
||||
dist/wazero_$(VERSION)_%.msi: build/wazero_%/wazero.exe.signed
|
||||
@echo msi "building $@"
|
||||
@mkdir -p $(@D)
|
||||
@wixl -a $(call msi-arch,$@) -D Version=$(MIS_VERSION) -D Bin=$(<:.signed=) -o $@ packaging/msi/wazero.wxs
|
||||
@wixl -a $(call msi-arch,$@) -D Version=$(MSI_VERSION) -D Bin=$(<:.signed=) -o $@ packaging/msi/wazero.wxs
|
||||
$(call codesign,$@)
|
||||
@echo msi "ok"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user