Skip to content

Commit 6284626

Browse files
committed
update CD workflow
1 parent bfd95c7 commit 6284626

File tree

1 file changed

+94
-96
lines changed

1 file changed

+94
-96
lines changed

.github/workflows/cd.yml

+94-96
Original file line numberDiff line numberDiff line change
@@ -83,100 +83,98 @@ jobs:
8383
${{ env.RELEASE_NAME }}-gnu-linux-aarch64.tar.gz
8484
${{ env.RELEASE_NAME }}-gnu-linux-aarch64.tar.gz.sha256
8585
86-
86+
macos_builds:
87+
runs-on: macos-latest
88+
steps:
89+
- name: Checkout the repository
90+
uses: actions/checkout@v2 # Checkout the repository to the runner
91+
92+
- name: Install rustup targets
93+
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
94+
95+
- name: Build the executable
96+
run: cargo build --release --target=x86_64-apple-darwin --target=aarch64-apple-darwin
97+
98+
- name: Build release name
99+
run: |
100+
PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
101+
PKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
102+
RELEASE_NAME="${PKG_NAME}_${PKG_VERSION}"
103+
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
104+
- name: Tar x86_64 binary
105+
run: |
106+
PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
107+
tar -czvf ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz -C target/x86_64-apple-darwin/release ${PKG_NAME}
108+
109+
- name: Tar arm64 binary
110+
run: |
111+
PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
112+
tar -czvf ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz -C target/aarch64-apple-darwin/release ${PKG_NAME}
113+
114+
- name: Generate SHA256 checksums
115+
run: |
116+
shasum -a 256 ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz > ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz.sha256
117+
shasum -a 256 ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz > ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz.sha256
118+
119+
- name: Upload release binaries
120+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
121+
env:
122+
GITHUB_TOKEN: ${{ github.token }}
123+
with:
124+
files: |
125+
${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz
126+
${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz
127+
${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz.sha256
128+
${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz.sha256
87129
88-
# macos_builds:
89-
# runs-on: macos-latest
90-
# steps:
91-
# - name: Checkout the repository
92-
# uses: actions/checkout@v2 # Checkout the repository to the runner
93-
94-
# - name: Install rustup targets
95-
# run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
96-
97-
# - name: Build the executable
98-
# run: cargo build --release --target=x86_64-apple-darwin --target=aarch64-apple-darwin
99-
100-
# - name: Build release name
101-
# run: |
102-
# PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
103-
# PKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
104-
# RELEASE_NAME="${PKG_NAME}_${PKG_VERSION}"
105-
# echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
106-
# - name: Tar x86_64 binary
107-
# run: |
108-
# PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
109-
# tar -czvf ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz -C target/x86_64-apple-darwin/release ${PKG_NAME}
110-
111-
# - name: Tar arm64 binary
112-
# run: |
113-
# PKG_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
114-
# tar -czvf ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz -C target/aarch64-apple-darwin/release ${PKG_NAME}
115-
116-
# - name: Generate SHA256 checksums
117-
# run: |
118-
# shasum -a 256 ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz > ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz.sha256
119-
# shasum -a 256 ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz > ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz.sha256
120-
121-
# - name: Upload release binaries
122-
# uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
123-
# env:
124-
# GITHUB_TOKEN: ${{ github.token }}
125-
# with:
126-
# files: |
127-
# ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz
128-
# ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz
129-
# ${{ env.RELEASE_NAME }}-macos-x86_64.tar.gz.sha256
130-
# ${{ env.RELEASE_NAME }}-macos-aarch64.tar.gz.sha256
131-
132-
# windows_builds:
133-
# runs-on: windows-latest
134-
# steps:
135-
# - name: Checkout the repository
136-
# uses: actions/checkout@v2 # Checkout the repository to the runner
137-
138-
# - name: Install rustup targets
139-
# run: rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc
140-
# shell: pwsh
141-
142-
# - name: Build the executable
143-
# run: |
144-
# cargo build --release --target=x86_64-pc-windows-msvc --target=aarch64-pc-windows-msvc
145-
# shell: pwsh
146-
147-
# - name: Build release name
148-
# run: |
149-
# $PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
150-
# $PKG_VERSION = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].version
151-
# $RELEASE_NAME = "${PKG_NAME}_${PKG_VERSION}"
152-
# echo "RELEASE_NAME=$RELEASE_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Append
153-
# shell: pwsh
154-
155-
# - name: Zip Windows x86_64 binary
156-
# run: |
157-
# $PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
158-
# & 7z a "$Env:RELEASE_NAME-windows-x86_64.zip" "target/x86_64-pc-windows-msvc/release/$PKG_NAME.exe"
159-
# shell: pwsh
160-
161-
# - name: Zip Windows ARM64 binary
162-
# run: |
163-
# $PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
164-
# & 7z a "$Env:RELEASE_NAME-windows-aarch64.zip" "target/aarch64-pc-windows-msvc/release/$PKG_NAME.exe"
165-
# shell: pwsh
166-
167-
# - name: Generate SHA256 checksums
168-
# run: |
169-
# Get-FileHash -Algorithm SHA256 "$Env:RELEASE_NAME-windows-x86_64.zip" | Format-List | Out-File "$Env:RELEASE_NAME-windows-x86_64.zip.sha256"
170-
# Get-FileHash -Algorithm SHA256 "$Env:RELEASE_NAME-windows-aarch64.zip" | Format-List | Out-File "$Env:RELEASE_NAME-windows-aarch64.zip.sha256"
171-
# shell: pwsh
172-
173-
# - name: Upload release binaries to GitHub
174-
# uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
175-
# env:
176-
# GITHUB_TOKEN: ${{ github.token }}
177-
# with:
178-
# files: |
179-
# ${{ env.RELEASE_NAME }}-windows-x86_64.zip
180-
# ${{ env.RELEASE_NAME }}-windows-aarch64.zip
181-
# ${{ env.RELEASE_NAME }}-windows-x86_64.zip.sha256
182-
# ${{ env.RELEASE_NAME }}-windows-aarch64.zip.sha256
130+
windows_builds:
131+
runs-on: windows-latest
132+
steps:
133+
- name: Checkout the repository
134+
uses: actions/checkout@v2 # Checkout the repository to the runner
135+
136+
- name: Install rustup targets
137+
run: rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc
138+
shell: pwsh
139+
140+
- name: Build the executable
141+
run: |
142+
cargo build --release --target=x86_64-pc-windows-msvc --target=aarch64-pc-windows-msvc
143+
shell: pwsh
144+
145+
- name: Build release name
146+
run: |
147+
$PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
148+
$PKG_VERSION = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].version
149+
$RELEASE_NAME = "${PKG_NAME}_${PKG_VERSION}"
150+
echo "RELEASE_NAME=$RELEASE_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Append
151+
shell: pwsh
152+
153+
- name: Zip Windows x86_64 binary
154+
run: |
155+
$PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
156+
& 7z a "$Env:RELEASE_NAME-windows-x86_64.zip" "target/x86_64-pc-windows-msvc/release/$PKG_NAME.exe"
157+
shell: pwsh
158+
159+
- name: Zip Windows ARM64 binary
160+
run: |
161+
$PKG_NAME = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages[0].name
162+
& 7z a "$Env:RELEASE_NAME-windows-aarch64.zip" "target/aarch64-pc-windows-msvc/release/$PKG_NAME.exe"
163+
shell: pwsh
164+
165+
- name: Generate SHA256 checksums
166+
run: |
167+
Get-FileHash -Algorithm SHA256 "$Env:RELEASE_NAME-windows-x86_64.zip" | Format-List | Out-File "$Env:RELEASE_NAME-windows-x86_64.zip.sha256"
168+
Get-FileHash -Algorithm SHA256 "$Env:RELEASE_NAME-windows-aarch64.zip" | Format-List | Out-File "$Env:RELEASE_NAME-windows-aarch64.zip.sha256"
169+
shell: pwsh
170+
171+
- name: Upload release binaries to GitHub
172+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
173+
env:
174+
GITHUB_TOKEN: ${{ github.token }}
175+
with:
176+
files: |
177+
${{ env.RELEASE_NAME }}-windows-x86_64.zip
178+
${{ env.RELEASE_NAME }}-windows-aarch64.zip
179+
${{ env.RELEASE_NAME }}-windows-x86_64.zip.sha256
180+
${{ env.RELEASE_NAME }}-windows-aarch64.zip.sha256

0 commit comments

Comments
 (0)