Skip to content

Commit

Permalink
chore(ci): Add aarch64 binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 20, 2025
1 parent 30a051f commit 50c5e55
Showing 1 changed file with 45 additions and 29 deletions.
74 changes: 45 additions & 29 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,39 @@ on:
push:
tags:
- "v*"

env:
CRATE_NAME: git-dive

# We need this to be able to create releases.
permissions:
contents: write

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}
tag: ${{ env.TAG }}
steps:
- name: Get the release version from the tag
shell: bash
if: env.RELEASE_VERSION == ''
run: |
# See: https://github.jparrowsec.cnmunity/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get the release version from the tag
if: env.TAG == ''
run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the tag
run: |
echo "tag is: $TAG"
- name: Generate Release Notes
run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md
./.github/workflows/release-notes.py --tag ${{ env.TAG }} --output notes-${{ env.TAG }}.md
cat notes-${{ env.TAG }}.md
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body_path: notes-${{ env.RELEASE_VERSION }}.md
GH_TOKEN: ${{ github.token }}
run: gh release create $TAG --verify-tag --draft --title $TAG --notes-file notes-${{ env.TAG }}.md
build-release:
name: build-release
needs: create-release
Expand All @@ -68,6 +67,10 @@ jobs:
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-aarch64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: win-msvc
os: windows-2019
rust: stable
Expand All @@ -93,27 +96,40 @@ jobs:
- name: Build archive
shell: bash
run: |
outdir="./target/${{ env.TARGET_DIR }}/release"
staging="${{ env.CRATE_NAME }}-${{ needs.create-release.outputs.release_version }}-${{ matrix.target }}"
mkdir -p "$staging"/{complete,doc}
outdir="./target/${{ matrix.target }}/release"
staging="${{ env.BIN_NAME }}-${{ needs.create-release.outputs.tag }}-${{ matrix.target }}"
mkdir -p "$staging"/doc
cp {README.md,LICENSE-*} "$staging/"
cp {CHANGELOG.md,docs/*} "$staging/doc/"
if [ "${{ matrix.os }}" = "windows-2019" ]; then
cp "target/${{ matrix.target }}/release/git-dive.exe" "$staging/"
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" "$staging/"
ls -l "$staging"
cd "$staging"
7z a "../$staging.zip" .
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/git-dive" "$staging/"
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/"
ls -l "$staging"
tar czf "$staging.tar.gz" -C "$staging" .
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
tag="${{ needs.create-release.outputs.tag }}"
gh release upload "$tag" ${{ env.ASSET }}
publish-release:
name: Publish Release
needs: [create-release, build-release]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
fetch-depth: 1
- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false

0 comments on commit 50c5e55

Please sign in to comment.