π Fix linux keyring failure (#78) #63
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: Draft Release | |
on: | |
push: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
meta: | |
name: Prepare draft release | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Export version | |
id: version | |
shell: bash | |
run: | | |
VERSION="$(cat Cargo.toml | grep -Pom1 '\d.\d.\d')" | |
echo "Drafting release for v$VERSION" | |
echo "::set-output name=version::$VERSION" | |
# Remove old release drafts by using the curl request for the available releases with draft flag | |
- name: Remove Old Release Drafts | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
run: | | |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \ | |
| tr '\r\n' ' ' \ | |
| jq '.[] | select(.draft == true) | .id' \ | |
| xargs -I '{}' \ | |
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{} | |
- name: Create a draft release | |
id: createDraftRelease | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
run: | | |
gh release create v${{ steps.version.outputs.version }}-next \ | |
--draft --generate-notes \ | |
--title v${{ steps.version.outputs.version }}-next | |
echo ${{ steps.version.outputs.version }} > VERSION | |
gh release upload v${{ steps.version.outputs.version }}-next VERSION | |
build: | |
name: Build binary | |
needs: [meta] | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
sha_tag: arm64_ventura | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
sha_tag: ventura | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
sha_tag: x86_64_linux | |
- target: x86_64-pc-windows-gnu | |
os: ubuntu-latest | |
sha_tag: x86_64_windows | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
override: true | |
- uses: Swatinem/rust-cache@v1 | |
- name: Install buildtools | |
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} | |
run: | | |
sudo apt install libdbus-1-dev | |
- name: Build release version | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.target == 'x86_64-pc-windows-gnu' }} | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Package binary | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
run: | | |
rm target/${{ matrix.target }}/release/toggl.d || true; | |
zip -j toggl-${{ matrix.target }}-${{ needs.meta.outputs.version }}.zip target/${{ matrix.target }}/release/*; | |
shasum -a 256 toggl-${{ matrix.target }}-${{ needs.meta.outputs.version }}.zip > ${{ matrix.sha_tag }}.sha256 | |
gh release upload v${{ needs.meta.outputs.version }}-next \ | |
'./toggl-${{ matrix.target }}-${{ needs.meta.outputs.version }}.zip' \ | |
'./${{ matrix.sha_tag }}.sha256'; |