fix: Implement repeated options (#138) #98
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
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+" | |
name: Release | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.x | |
- name: Setup dependencies | |
run: | | |
version="${GITHUB_REF##*/}" | |
echo "version is $version" | |
echo "::group::install tidy + htmlq" | |
sudo apt-get install tidy | |
curl -LO https://github.com/mgdm/htmlq/releases/download/v0.4.0/htmlq-x86_64-linux.tar.gz | |
tar xf htmlq-x86_64-linux.tar.gz | |
sudo mv htmlq /usr/local/bin/htmlq | |
echo "::endgroup::" | |
echo "::group::build compa" | |
go build -ldflags "-s -w -X main.version=CI" -o compa | |
echo "::endgroup::" | |
echo "::group::Release notes" | |
mkdir -p dist | |
refURL=$(curl --silent --show-error --fail \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/unRob/milpa/git/refs/tags/$version" | | |
jq -r .object.url) | |
curl --silent --show-error --fail \ | |
-H "Accept: application/vnd.github.v3+json" "$refURL" | | |
jq -r '.message' > dist/release-notes.md | |
wc -c dist/release-notes.md | |
cat dist/release-notes.md | |
echo "::endgroup::" | |
go get -u github.com/mitchellh/gox | |
go install github.com/mitchellh/gox | |
- name: create release | |
id: build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
version="${GITHUB_REF##*/}" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
export MILPA_ROOT=$(pwd) | |
export MILPA_UPDATE_CHECK_DISABLED="1" | |
export PATH="$PATH:$(pwd)" | |
prerelease="false" | |
if [[ "$GITHUB_REF" == *-* ]]; then | |
prerelease="true" | |
echo "Building a pre-release" | |
fi | |
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT | |
echo "::group::building release" | |
$(pwd)/milpa release build --parallel 2 "${version}" | |
echo "::endgroup::" | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: dist/release-notes.md | |
files: | | |
dist/*.tgz | |
dist/*.shasum | |
prerelease: ${{ steps.build.outputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
- name: update github pages | |
uses: JamesIves/[email protected] | |
# re-enable when we only wanna build for stable releases | |
# if: ${{ steps.build.outputs.prerelease == "false" }} | |
with: | |
branch: gh-pages | |
folder: dist/milpa.dev | |
- name: update homebrew formulas | |
# re-enable when we only wanna build for stable releases | |
# if: ${{ steps.build.outputs.prerelease == "false" }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.FORMULAS_PAT }} | |
VERSION: ${{ steps.build.outputs.version }} | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/unRob/homebrew-formulas/actions/workflows/version-bump.yml/dispatches \ | |
-d '{"ref":"main","inputs":{ "formula": "Formula/milpa.rb", "version": "'"$VERSION"'" }}' |