Update release.yml #36
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 | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- v[0-9]+.* | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: taiki-e/create-gh-release-action@v1 | |
with: | |
token: ${{ secrets.RELEASE_GH_TOKEN }} | |
upload-public-assets: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
- name: Install Ubuntu dependencies | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: export DEBIAN_FRONTEND=noninteractive && sudo apt update && sudo apt install -y librust-alsa-sys-dev | |
- name: Add fake empty dependency | |
shell: bash | |
run: crates/fake-glass.sh | |
- name: Build and upload | |
uses: taiki-e/upload-rust-binary-action@v1 | |
with: | |
bin: steel | |
token: ${{ secrets.RELEASE_GH_TOKEN }} | |
upload-private-assets: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
- name: Install Ubuntu dependencies | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: export DEBIAN_FRONTEND=noninteractive && sudo apt update && sudo apt install -y librust-alsa-sys-dev | |
- name: Clone glass dependency | |
uses: actions/checkout@v3 | |
with: | |
repository: TicClick/glass | |
path: crates/glass | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Build (private) | |
uses: taiki-e/upload-rust-binary-action@v1 | |
env: | |
# https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli -- `git clone` uses private access token | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
with: | |
dry-run: true | |
bin: steel | |
features: glass | |
- name: Upload (private) | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
run: | | |
existing_files=$( gh gist view "${ASSET_GIST_HASH}" --files ) | |
platform_binary=$( ls steel-* ) | |
if [[ ${existing_files} != *${platform_binary}* ]]; then | |
gh gist edit "${ASSET_GIST_HASH}" --add "${platform_binary}" "${platform_binary}" | |
else | |
gh gist edit "${ASSET_GIST_HASH}" --filename "${platform_binary}" "${platform_binary}" | |
fi | |
update-private-metadata: | |
runs-on: ubuntu-latest | |
needs: upload-private-assets | |
steps: | |
- name: Tag all assets | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
run: | | |
gh gist clone "${ASSET_GIST_HASH}" | |
cd "${ASSET_GIST_HASH}" | |
git tag ${{ github.ref_name }} | |
git push --tags | |
- name: Update releases.json | |
shell: bash | |
run: .github/update-private-metadata.py | |
env: | |
ASSET_GIST_OWNER: TicClick | |
TAG_NAME: ${{ github.ref_name }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
METADATA_GIST_HASH: ${{ secrets.METADATA_GIST_HASH }} |