Skip to content

Commit 50c5e55

Browse files
committed
chore(ci): Add aarch64 binaries
1 parent 30a051f commit 50c5e55

File tree

1 file changed

+45
-29
lines changed

1 file changed

+45
-29
lines changed

.github/workflows/post-release.yml

+45-29
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,39 @@ on:
1818
push:
1919
tags:
2020
- "v*"
21+
2122
env:
2223
CRATE_NAME: git-dive
24+
25+
# We need this to be able to create releases.
26+
permissions:
27+
contents: write
28+
2329
jobs:
2430
create-release:
2531
name: create-release
2632
runs-on: ubuntu-latest
2733
outputs:
28-
upload_url: ${{ steps.release.outputs.upload_url }}
29-
release_version: ${{ env.RELEASE_VERSION }}
34+
tag: ${{ env.TAG }}
3035
steps:
31-
- name: Get the release version from the tag
32-
shell: bash
33-
if: env.RELEASE_VERSION == ''
34-
run: |
35-
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
36-
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
37-
echo "version is: ${{ env.RELEASE_VERSION }}"
3836
- name: Checkout repository
3937
uses: actions/checkout@v4
4038
with:
4139
fetch-depth: 1
40+
- name: Get the release version from the tag
41+
if: env.TAG == ''
42+
run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
43+
- name: Show the tag
44+
run: |
45+
echo "tag is: $TAG"
4246
- name: Generate Release Notes
4347
run: |
44-
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
45-
cat notes-${{ env.RELEASE_VERSION }}.md
48+
./.github/workflows/release-notes.py --tag ${{ env.TAG }} --output notes-${{ env.TAG }}.md
49+
cat notes-${{ env.TAG }}.md
4650
- name: Create GitHub release
47-
id: release
48-
uses: actions/create-release@v1
4951
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
with:
52-
tag_name: ${{ env.RELEASE_VERSION }}
53-
release_name: ${{ env.RELEASE_VERSION }}
54-
body_path: notes-${{ env.RELEASE_VERSION }}.md
52+
GH_TOKEN: ${{ github.token }}
53+
run: gh release create $TAG --verify-tag --draft --title $TAG --notes-file notes-${{ env.TAG }}.md
5554
build-release:
5655
name: build-release
5756
needs: create-release
@@ -68,6 +67,10 @@ jobs:
6867
os: macos-latest
6968
rust: stable
7069
target: x86_64-apple-darwin
70+
- build: macos-aarch64
71+
os: macos-latest
72+
rust: stable
73+
target: aarch64-apple-darwin
7174
- build: win-msvc
7275
os: windows-2019
7376
rust: stable
@@ -93,27 +96,40 @@ jobs:
9396
- name: Build archive
9497
shell: bash
9598
run: |
96-
outdir="./target/${{ env.TARGET_DIR }}/release"
97-
staging="${{ env.CRATE_NAME }}-${{ needs.create-release.outputs.release_version }}-${{ matrix.target }}"
98-
mkdir -p "$staging"/{complete,doc}
99+
outdir="./target/${{ matrix.target }}/release"
100+
staging="${{ env.BIN_NAME }}-${{ needs.create-release.outputs.tag }}-${{ matrix.target }}"
101+
mkdir -p "$staging"/doc
99102
cp {README.md,LICENSE-*} "$staging/"
100103
cp {CHANGELOG.md,docs/*} "$staging/doc/"
101104
if [ "${{ matrix.os }}" = "windows-2019" ]; then
102-
cp "target/${{ matrix.target }}/release/git-dive.exe" "$staging/"
105+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" "$staging/"
106+
ls -l "$staging"
103107
cd "$staging"
104108
7z a "../$staging.zip" .
105109
echo "ASSET=$staging.zip" >> $GITHUB_ENV
106110
else
107-
cp "target/${{ matrix.target }}/release/git-dive" "$staging/"
111+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/"
112+
ls -l "$staging"
108113
tar czf "$staging.tar.gz" -C "$staging" .
109114
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
110115
fi
111116
- name: Upload release archive
112-
uses: actions/[email protected]
113117
env:
114-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
GH_TOKEN: ${{ github.token }}
119+
shell: bash
120+
run: |
121+
tag="${{ needs.create-release.outputs.tag }}"
122+
gh release upload "$tag" ${{ env.ASSET }}
123+
publish-release:
124+
name: Publish Release
125+
needs: [create-release, build-release]
126+
runs-on: ubuntu-latest
127+
steps:
128+
- name: Checkout repository
129+
uses: actions/checkout@v4
115130
with:
116-
upload_url: ${{ needs.create-release.outputs.upload_url }}
117-
asset_path: ${{ env.ASSET }}
118-
asset_name: ${{ env.ASSET }}
119-
asset_content_type: application/octet-stream
131+
fetch-depth: 1
132+
- name: Publish Release
133+
env:
134+
GH_TOKEN: ${{ github.token }}
135+
run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false

0 commit comments

Comments
 (0)