Skip to content

Commit

Permalink
update release workflow for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper committed May 13, 2024
1 parent 577a8a4 commit b003d11
Showing 1 changed file with 64 additions and 3 deletions.
67 changes: 64 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Add artifacts to release

on:
workflow_dispatch: # TODO: Remove when this is working
release:
types: [created]
workflow_dispatch:

jobs:
release:
Expand All @@ -15,10 +15,9 @@ jobs:
include:
- target: x86_64-unknown-linux-musl
- target: x86_64-pc-windows-gnu
- target: x86_64-apple-darwin
# TODO: How?
# - target: x86_64-unknown-linux-gnu
# - target: aarch64-unknown-linux-musl
# - target: aarch64-apple-darwin
steps:
- uses: actions/checkout@master
- name: Compile and release
Expand All @@ -30,3 +29,65 @@ jobs:
TOOLCHAIN_VERSION: 1.78.0
ARCHIVE_TYPES: tar.gz zip
EXTRA_FILES: LICENSE README.md sigi.1

release-macos:
name: release ${{ matrix.target }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
- target: x86_64-apple-darwin
env:
ASSET_NAME: sigi_${{ github.event.release.tag_name }}_${{ matrix.target }}
RELEASE_URL: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets
steps:
- uses: actions/checkout@master
- run: rustup update stable && rustup default stable
- run: rustup target add ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }} --release --verbose
- run: cargo test --target ${{ matrix.target }} --release --verbose
- run: mv target/${{ matrix.target }}/release/sigi sigi
- run: zip ${{ env.ASSET_NAME }}.zip sigi LICENSE README.md sigi.1
- run: shasum -a 256 ${{ env.ASSET_NAME }}.zip >${{ env.ASSET_NAME }}.zip.sha256sum
- run: tar -czvf ${{ env.ASSET_NAME }}.tar.gz sigi LICENSE README.md sigi.1
- run: shasum -a 256 ${{ env.ASSET_NAME }}.tar.gz >${{ env.ASSET_NAME }}.tar.gz.sha256sum

# https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset
- name: upload zip
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${{ env.RELEASE_URL}}?name=${{ env.ASSET_NAME }}.zip" \
--data-binary "@${{ env.ASSET_NAME }}.zip"
- name: upload zip sha256sum
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${{ env.RELEASE_URL}}?name=${{ env.ASSET_NAME }}.zip.sha256sum" \
--data-binary "@${{ env.ASSET_NAME }}.zip.sha256sum"
- name: upload tarball
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${{ env.RELEASE_URL}}?name=${{ env.ASSET_NAME }}.tar.gz" \
--data-binary "@${{ env.ASSET_NAME }}.tar.gz"
- name: upload tarball sha256sum
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${{ env.RELEASE_URL}}?name=${{ env.ASSET_NAME }}.tar.gz.sha256sum" \
--data-binary "@${{ env.ASSET_NAME }}.tar.gz.sha256sum"

0 comments on commit b003d11

Please sign in to comment.