163 lines
6.8 KiB
YAML
163 lines
6.8 KiB
YAML
name: release
|
|
permissions:
|
|
contents: write
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*-?v[0-9]+*'
|
|
|
|
jobs:
|
|
# Create the Github Release™ so the packages have something to be uploaded to
|
|
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: https://github.com/taiki-e/create-gh-release-action@v1
|
|
with:
|
|
# (Optional) Path to changelog.
|
|
changelog: CHANGELOG.md
|
|
# (Required) GitHub token for creating GitHub Releases.
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
draft: true
|
|
branch: main
|
|
|
|
# create-release:
|
|
# runs-on: ubuntu-latest
|
|
# outputs:
|
|
# has-releases: ${{ steps.create-release.outputs.has-releases }}
|
|
# env:
|
|
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# steps:
|
|
# - uses: actions/checkout@v3
|
|
# - name: Install Rust
|
|
# run: rustup update 1.67.1 --no-self-update && rustup default 1.67.1
|
|
# - name: Install cargo-dist
|
|
# run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.5/cargo-dist-v0.0.5-installer.sh | sh
|
|
# - id: create-release
|
|
# run: |
|
|
# cargo dist manifest --tag=${{ github.ref_name }} --artifacts=all --no-local-paths --output-format=json > dist-manifest.json
|
|
# echo "dist manifest ran successfully"
|
|
# cat dist-manifest.json
|
|
|
|
# # Create the Github Release™ based on what cargo-dist thinks it should be
|
|
# ANNOUNCEMENT_TITLE=$(cat dist-manifest.json | jq --raw-output ".announcement_title")
|
|
# IS_PRERELEASE=$(cat dist-manifest.json | jq --raw-output ".announcement_is_prerelease")
|
|
# cat dist-manifest.json | jq --raw-output ".announcement_github_body" > new_dist_announcement.md
|
|
# gh release create ${{ github.ref_name }} --draft --prerelease="$IS_PRERELEASE" --title="$ANNOUNCEMENT_TITLE" --notes-file=new_dist_announcement.md
|
|
# echo "created announcement!"
|
|
|
|
# # Upload the manifest to the Github Release™
|
|
# gh release upload ${{ github.ref_name }} dist-manifest.json
|
|
# echo "uploaded manifest!"
|
|
|
|
# # Disable all the upload-artifacts tasks if we have no actual releases
|
|
# HAS_RELEASES=$(cat dist-manifest.json | jq --raw-output ".releases != null")
|
|
# echo "has-releases=$HAS_RELEASES" >> "$GITHUB_OUTPUT"
|
|
|
|
approve-release:
|
|
# Only run after all the other tasks
|
|
needs: [create-release]
|
|
permissions:
|
|
issues: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://github.com/trstringer/manual-approval@v1
|
|
with:
|
|
secret: ${{ github.TOKEN }}
|
|
approvers: hmuendel
|
|
minimum-approvals: 1
|
|
issue-title: "Release: ${{ github.ref_name }}"
|
|
issue-body: "Please approve or deny the release of version ${{ github.ref_name }}"
|
|
exclude-workflow-initiator-as-approver: false
|
|
additional-approved-words: 'sure,go,continue'
|
|
additional-denied-words: 'nope,cancel,stop'
|
|
|
|
upload-assets:
|
|
needs: [create-release]
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-latest
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: https://github.com/taiki-e/upload-rust-binary-action@v1
|
|
with:
|
|
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
|
|
# Note that glob pattern is not supported yet.
|
|
# TODO: Make this general
|
|
bin: rust-ci-test-repo
|
|
# (optional) On which platform to distribute the `.tar.gz` file.
|
|
# [default value: unix]
|
|
# [possible values: all, unix, windows, none]
|
|
tar: unix
|
|
# (optional) On which platform to distribute the `.zip` file.
|
|
# [default value: windows]
|
|
# [possible values: all, unix, windows, none]
|
|
zip: windows
|
|
# (required) GitHub token for uploading assets to GitHub Releases.
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
checksum: sha256
|
|
include: LICENSE,README.md
|
|
|
|
# Build and packages all the things
|
|
# upload-artifacts:
|
|
# # Let the initial task tell us to not run (currently very blunt)
|
|
# needs: create-release
|
|
# if: ${{ needs.create-release.outputs.has-releases == 'true' }}
|
|
# strategy:
|
|
# matrix:
|
|
# # For these target platforms
|
|
# include:
|
|
# - os: macos-11
|
|
# dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
|
|
# install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.5/cargo-dist-v0.0.5-installer.sh | sh
|
|
# - os: ubuntu-20.04
|
|
# dist-args: --artifacts=local --target=x86_64-unknown-linux-gnu
|
|
# install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.5/cargo-dist-v0.0.5-installer.sh | sh
|
|
# - os: windows-2019
|
|
# dist-args: --artifacts=local --target=x86_64-pc-windows-msvc
|
|
# install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.0.5/cargo-dist-v0.0.5-installer.ps1 | iex
|
|
|
|
# runs-on: ${{ matrix.os }}
|
|
# env:
|
|
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# steps:
|
|
# - uses: actions/checkout@v3
|
|
# - name: Install Rust
|
|
# run: rustup update 1.67.1 --no-self-update && rustup default 1.67.1
|
|
# - name: Install cargo-dist
|
|
# run: ${{ matrix.install-dist }}
|
|
# - name: Run cargo-dist
|
|
# # This logic is a bit janky because it's trying to be a polyglot between
|
|
# # powershell and bash since this will run on windows, macos, and linux!
|
|
# # The two platforms don't agree on how to talk about env vars but they
|
|
# # do agree on 'cat' and '$()' so we use that to marshal values between commands.
|
|
# run: |
|
|
# # Actually do builds and make zips and whatnot
|
|
# cargo dist build --tag=${{ github.ref_name }} --output-format=json ${{ matrix.dist-args }} > dist-manifest.json
|
|
# echo "dist ran successfully"
|
|
# cat dist-manifest.json
|
|
|
|
# # Parse out what we just built and upload it to the Github Release™
|
|
# cat dist-manifest.json | jq --raw-output ".artifacts[]?.path | select( . != null )" > uploads.txt
|
|
# echo "uploading..."
|
|
# cat uploads.txt
|
|
# gh release upload ${{ github.ref_name }} $(cat uploads.txt)
|
|
# echo "uploaded!"
|
|
|
|
publish-release:
|
|
# Only run after all the other tasks, but it's ok if upload-artifacts was skipped
|
|
needs: [approve-release, upload-assets]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: mark release as non-draft
|
|
run: |
|
|
gh release edit ${{ github.ref_name }} --draft=false
|