Skip to content

Commit

Permalink
release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Feb 21, 2024
1 parent 0047fcf commit 8bd64ee
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 64 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,8 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -410,12 +407,9 @@ jobs:
files: |
go.mod
go.sum
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
if: steps.changed-files.outputs.any_changed == 'true'
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: update gomod2nix
Expand Down
55 changes: 11 additions & 44 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand All @@ -39,11 +36,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -85,11 +79,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand All @@ -107,11 +98,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -145,11 +133,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -183,11 +168,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -221,11 +203,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -259,11 +238,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -297,11 +273,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -335,11 +308,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down Expand Up @@ -374,11 +344,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ jobs:
environment: release
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -53,15 +50,15 @@ jobs:
release-macos:
# runs sequentially to avoid creating duplicated release
needs: ["release"]
runs-on: macos-latest
strategy:
matrix:
runner: [macos-latest, macos-14]
runs-on: ${{ matrix.runner }}
environment: release
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -95,10 +92,11 @@ jobs:
done
# update checksum and upload
sha256sum *.tar.gz > "checksums-darwin.txt"
CHKFILE="checksums-darwin-$(uname -p).txt"
sha256sum *.tar.gz > "$CHKFILE"
echo 'FILES<<EOF' >> $GITHUB_ENV
ls -1 *.tar.gz >> $GITHUB_ENV
echo "checksums-darwin.txt" >> $GITHUB_ENV
echo "$CHKFILE" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
cat $GITHUB_ENV
- name: upload binaries
Expand Down
6 changes: 5 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ if [[ "$build_platform" == "x86_64-linux" ]]; then
elif [[ "$build_platform" == "aarch64-linux" ]]; then
hosts="Linux_arm64,native Linux_x86_64,gnu64 Windows_x86_64,mingwW64"
elif [[ "$build_platform" == "x86_64-darwin" ]]; then
hosts="Darwin_x86_64,native Darwin_arm64,aarch64-darwin"
hosts="Darwin_x86_64,native"
elif [[ "$build_platform" == "aarch64-darwin" ]]; then
# cross compiling to x86_64-darwin from aarch64-darwin is not supported
# see: https://github.com/NixOS/nixpkgs/issues/180771
hosts="Darwin_arm64,native"
else
echo "don't support build platform: $build_platform"
exit 1
Expand Down

0 comments on commit 8bd64ee

Please sign in to comment.