Skip to content

Commit ec08243

Browse files
committed
Revamp workflow
Fix private repo access Add build dependencies Fix env-var on Windows Disable Windows build due to #58
1 parent d2c1ba0 commit ec08243

File tree

2 files changed

+70
-58
lines changed

2 files changed

+70
-58
lines changed

.github/workflows/release.yaml

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ name: Build and release gatewayd-plugin-cache
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77

88
permissions:
99
contents: write
1010

1111
jobs:
12-
build-and-release-linux:
13-
runs-on: ubuntu-latest
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
# Windows build is disabled due to the following issue:
17+
# https://github.com/gatewayd-io/gatewayd-plugin-cache/issues/58
18+
os: [ubuntu-latest, macos-latest] #, windows-latest]
1419
steps:
1520
- name: Checkout code
1621
uses: actions/checkout@v3
@@ -19,80 +24,79 @@ jobs:
1924
- name: Set up Go 1.20
2025
uses: actions/setup-go@v3
2126
with:
22-
go-version: '1.20'
27+
go-version: "1.20"
2328
cache: true
24-
- run: |
29+
# - name: Set up git and download dependencies
30+
# if: matrix.os == 'windows-latest'
31+
# run: |
32+
# git config --global url."https://mostafa:%TOKEN%@github.com/".insteadOf "https://github.com"
33+
# go mod tidy
34+
- name: Set up git and download dependencies
35+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
36+
run: |
2537
git config --global url."https://mostafa:${TOKEN}@github.com/".insteadOf "https://github.com"
2638
go mod tidy
2739
env:
2840
TOKEN: ${{ secrets.GH_SDK_TOKEN }}
2941
GOPRIVATE: github.com/gatewayd-io/gatewayd-*
42+
- name: Install dependencies
43+
if: matrix.os == 'ubuntu-latest'
44+
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
3045
- name: Build and release binaries
31-
run: make build-release-linux
32-
- name: Create release and add artifacts
33-
uses: softprops/action-gh-release@v1
46+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
47+
run: |
48+
if [ "$RUNNER_OS" == "Linux" ]; then
49+
make build-release-linux
50+
elif [ "$RUNNER_OS" == "macOS" ]; then
51+
make build-release-darwin
52+
fi
53+
# - name: Build and release binaries
54+
# if: matrix.os == 'windows-latest'
55+
# run: |
56+
# make build-release-windows
57+
- name: Upload binaries and checksums
58+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
59+
uses: actions/upload-artifact@v3
3460
with:
35-
files: |
36-
dist/*.tar.gz
37-
dist/checksums.txt
38-
draft: false
39-
prerelease: false
40-
tag_name: ${{ github.ref_name }}
41-
name: ${{ github.ref_name }}
42-
generate_release_notes: true
43-
build-and-release-darwin:
44-
runs-on: macos-latest
61+
path: dist/*.tar.gz
62+
name: dist-${{ matrix.os }}
63+
if-no-files-found: warn
64+
# - name: Upload binaries and checksums
65+
# if: matrix.os == 'windows-latest'
66+
# uses: actions/upload-artifact@v3
67+
# with:
68+
# path: dist/*.zip
69+
# name: dist-${{ matrix.os }}
70+
# if-no-files-found: warn
71+
release:
72+
needs: build
73+
runs-on: ubuntu-latest
4574
steps:
4675
- name: Checkout code
4776
uses: actions/checkout@v3
4877
with:
4978
fetch-depth: 0
50-
- name: Set up Go 1.20
51-
uses: actions/setup-go@v3
52-
with:
53-
go-version: '1.20'
54-
cache: true
55-
- run: |
56-
go mod tidy
57-
env:
58-
GOPRIVATE: github.com/gatewayd-io/gatewayd-*
59-
- name: Build and release binaries
60-
run: make build-release-darwin
61-
- name: Create release and add artifacts
62-
uses: softprops/action-gh-release@v1
79+
# - name: Download binaries and checksums for Windows
80+
# uses: actions/download-artifact@v3
81+
# with:
82+
# name: dist-windows-latest
83+
- name: Download binaries and checksums for Linux
84+
uses: actions/download-artifact@v3
6385
with:
64-
files: |
65-
dist/*.tar.gz
66-
dist/checksums.txt
67-
draft: false
68-
prerelease: false
69-
tag_name: ${{ github.ref_name }}
70-
name: ${{ github.ref_name }}
71-
generate_release_notes: true
72-
build-and-release-windows:
73-
runs-on: windows-latest
74-
steps:
75-
- name: Checkout code
76-
uses: actions/checkout@v3
86+
name: dist-ubuntu-latest
87+
- name: Download binaries and checksums for macOS
88+
uses: actions/download-artifact@v3
7789
with:
78-
fetch-depth: 0
79-
- name: Set up Go 1.20
80-
uses: actions/setup-go@v3
81-
with:
82-
go-version: '1.20'
83-
cache: true
84-
- run: |
85-
go mod tidy
86-
env:
87-
GOPRIVATE: github.com/gatewayd-io/gatewayd-*
88-
- name: Build and release binaries
89-
run: make build-release-windows
90+
name: dist-macos-latest
91+
- name: Generate release checksums
92+
run: make generate-release-checksums
9093
- name: Create release and add artifacts
9194
uses: softprops/action-gh-release@v1
9295
with:
9396
files: |
94-
dist/*.zip
95-
dist/checksums.txt
97+
*.tar.gz
98+
checksums.txt
99+
# *.zip
96100
draft: false
97101
prerelease: false
98102
tag_name: ${{ github.ref_name }}

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,11 @@ build-release-linux: tidy create-build-dir build-linux-amd64 build-linux-arm64
7878
build-release-darwin: tidy create-build-dir build-darwin-amd64 build-darwin-arm64
7979

8080
build-release-windows: tidy create-build-dir build-windows-amd64 build-windows-arm64
81+
82+
generate-release-checksums:
83+
@sha256sum gatewayd-plugin-cache-linux-amd64-${VERSION}.tar.gz > checksums.txt
84+
@sha256sum gatewayd-plugin-cache-linux-arm64-${VERSION}.tar.gz >> checksums.txt
85+
@sha256sum gatewayd-plugin-cache-darwin-amd64-${VERSION}.tar.gz >> checksums.txt
86+
@sha256sum gatewayd-plugin-cache-darwin-arm64-${VERSION}.tar.gz >> checksums.txt
87+
# @sha256sum gatewayd-plugin-cache-windows-amd64-${VERSION}.zip >> checksums.txt
88+
# @sha256sum gatewayd-plugin-cache-windows-arm64-${VERSION}.zip >> checksums.txt

0 commit comments

Comments
 (0)