Skip to content

Commit

Permalink
Merge pull request #7 from scullionw/gh-actions-release
Browse files Browse the repository at this point in the history
Gh actions release
  • Loading branch information
scullionw authored Dec 30, 2021
2 parents 5188a04 + 41e2e08 commit 68128b0
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: macos-11

steps:
- uses: actions/checkout@v2

- name: Get version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=x86_64-apple-darwin

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=aarch64-apple-darwin

- name: Universal binary
run: |
mkdir -p target/universal-apple-darwin/release
lipo -create -output target/universal-apple-darwin/release/ds target/aarch64-apple-darwin/release/ds target/x86_64-apple-darwin/release/ds
- name: Create tar
run: |
tar -C ./target/universal-apple-darwin/release/ -czf dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz ./ds
- name: Set SHA
id: shasum
run: |
echo ::set-output name=sha::"$(shasum -a 256 ./dirstat-rs.tar.gz | awk '{printf $1}')"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz
asset_name: dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz
asset_content_type: application/gzip

0 comments on commit 68128b0

Please sign in to comment.