chore: uptick version and update deps #20
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: release | |
on: | |
push: | |
# Releases are tags named 'v<version>', and must have the "major.minor.micro", for example: "0.1.0". | |
# Release candidates are tagged as `v<version>-rc<num>`, for example: "0.1.0-rc1". | |
tags: | |
- "v*" | |
permissions: | |
contents: write # for creating a release | |
jobs: | |
init: | |
runs-on: ubuntu-22.04 | |
outputs: | |
version: ${{steps.version.outputs.version}} | |
prerelease: ${{steps.state.outputs.prerelease}} | |
steps: | |
- name: Evaluate state | |
id: state | |
env: | |
HEAD_REF: ${{github.head_ref}} | |
run: | | |
test -z "${HEAD_REF}" && (echo 'do-publish=true' >> $GITHUB_OUTPUT) | |
if [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo release=true >> $GITHUB_OUTPUT | |
elif [[ "${{ github.event.ref }}" =~ ^refs/tags/v.*$ ]]; then | |
echo prerelease=true >> $GITHUB_OUTPUT | |
fi | |
- name: Set version | |
id: version | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo "Version: $VERSION" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
# check that our CI would pass | |
ci: | |
uses: ./.github/workflows/ci.yaml | |
# now do the actual (release) builds | |
build: | |
needs: | |
- init | |
- ci | |
strategy: | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- x86_64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
- x86_64-unknown-linux-musl | |
- x86_64-apple-darwin | |
- aarch64-apple-darwin | |
- x86_64-pc-windows-msvc | |
include: | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
cross: "true" | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
install: | | |
sudo apt install -y libssl-dev | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-22.04 | |
cross: "true" | |
args: --features vendored | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-22.04 | |
install: | | |
sudo apt install -y musl-tools | |
args: --features vendored | |
- target: x86_64-apple-darwin | |
os: macos-13 | |
args: --features vendored | |
- target: aarch64-apple-darwin | |
os: macos-14 | |
args: --features vendored | |
- target: x86_64-pc-windows-msvc | |
os: windows-2022 | |
exe: ".exe" | |
install: | | |
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append | |
vcpkg install openssl:x64-windows-static-md | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Export GitHub Actions cache environment variables | |
uses: actions/github-script@v7 | |
if: runner.os == 'Windows' | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite'); | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.toml') }} | |
- name: Disable rustup auto update | |
run: | | |
rustup set auto-self-update disable | |
- run: rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- name: Install dependencies | |
if: matrix.install != '' | |
run: ${{ matrix.install }} | |
- name: Prepare cross | |
if: matrix.cross == 'true' | |
run: | | |
curl -sSL https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz -o binstall.tar.gz | |
tar xzf binstall.tar.gz | |
mv cargo-binstall $HOME/.cargo/bin/ | |
cargo binstall cross -y | |
- name: Build | |
shell: bash | |
run: | | |
if [[ "${{ matrix.xcode }}" == "true" ]]; then | |
export SDKROOT=$(xcrun -sdk macosx --show-sdk-path) | |
export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) | |
fi | |
OPTS="--release" | |
if [[ -n "${{ matrix.target }}" ]]; then | |
OPTS="$OPTS --target=${{ matrix.target }}" | |
fi | |
OPTS="$OPTS ${{ matrix.args }}" | |
CMD="cargo" | |
if [[ -n "${{ matrix.cross }}" ]]; then | |
CMD="cross" | |
fi | |
${CMD} build ${OPTS} | |
- name: List output | |
shell: bash | |
run: | | |
ls -l target/ | |
- name: Copy binary | |
shell: bash | |
run: | | |
mkdir -p upload | |
# if we have an alternate target, there is a sub-directory | |
if [[ -f "target/release/oidc${{ matrix.exe }}" ]]; then | |
SRC="target/release/oidc${{ matrix.exe }}" | |
elif [[ -f "target/${{ matrix.target }}/release/oidc${{ matrix.exe }}" ]]; then | |
SRC="target/${{ matrix.target }}/release/oidc${{ matrix.exe }}" | |
else | |
echo "Unable to find output" | |
false # stop build | |
fi | |
# for upload | |
cp -pv "${SRC}" upload/oidc-${{ matrix.target }}${{ matrix.exe }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: oidc-${{ matrix.target }} | |
path: upload/oidc-${{ matrix.target }}${{ matrix.exe }} | |
if-no-files-found: error | |
publish: | |
needs: [ init, build ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install convco | |
run: | | |
curl -sLO https://github.com/convco/convco/releases/download/v0.5.1/convco-ubuntu.zip | |
unzip convco-ubuntu.zip | |
sudo install convco /usr/local/bin | |
- name: Generate changelog | |
run: | | |
convco changelog -s --max-majors=1 --max-minors=1 --max-patches=1 -n > /tmp/changelog.md | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ~/download | |
- name: Display downloaded content | |
run: ls -R ~/download | |
- name: Stage release | |
run: | | |
mkdir -p staging | |
cp -pv ~/download/*/oidc-* staging/ | |
- name: Display staging area | |
run: ls -R staging | |
- name: Create Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG: v${{ needs.init.outputs.version }} | |
run: | | |
OPTS="" | |
if [[ "${{ needs.init.outputs.prerelease }}" == "true" ]]; then | |
OPTS="${OPTS} -p" | |
fi | |
gh release create ${OPTS} --title "${{ needs.init.outputs.version }}" -F /tmp/changelog.md ${TAG} \ | |
$(find staging -type f) |