setup ssh #49
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: Setup SSH Action | |
uses: LuisEnMarroquin/setup-ssh-action@v2.0.0 | |
with: | |
SSHKEY: $${{ secrets.SSH_PRIVKEY }} | |
- name: Build (private) | |
uses: taiki-e/upload-rust-binary-action@v1 | |
with: | |
dry-run: true | |
bin: steel | |
features: glass | |
- name: Upload (private) | |
shell: bash | |
env: | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
run: | | |
platform_binary=$( ls steel-* ) | |
git clone git@gist.github.com:${ASSET_GIST_HASH}.git && cd ${ASSET_GIST_HASH} | |
git config user.name "TicClick" && git config user.email "ya@ticclick.ch" | |
cp "../${platform_binary}" . && git add "${platform_binary}" | |
git commit -m "${{ github.ref_name }}: update ${platform_binary}" | |
for i in {0..4}; do | |
if ! git push origin master ; then | |
if [[ $i -eq 4 ]]; then | |
echo "git pull/push: failed after 4 retries" && exit 1 | |
fi | |
git pull -s ours | |
else | |
break | |
fi | |
done | |
update-private-metadata: | |
runs-on: ubuntu-latest | |
needs: upload-private-assets | |
steps: | |
- name: Setup SSH Action | |
uses: LuisEnMarroquin/setup-ssh-action@v2.0.0 | |
with: | |
SSHKEY: $${{ secrets.SSH_PRIVKEY }} | |
- name: Tag all assets | |
shell: bash | |
env: | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
run: | | |
git clone git@gist.github.com:${ASSET_GIST_HASH}.git && cd ${ASSET_GIST_HASH} | |
git config user.name "TicClick" && git config user.email "ya@ticclick.ch" | |
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.GH_TOKEN }} | |
ASSET_GIST_HASH: ${{ secrets.ASSET_GIST_HASH }} | |
METADATA_GIST_HASH: ${{ secrets.METADATA_GIST_HASH }} |