Skip to content

Commit 45de844

Browse files
committed
feat: implement clean multi-job workflow with separate macOS and Ubuntu runners
1 parent ac73cc0 commit 45de844

File tree

2 files changed

+52
-33
lines changed

2 files changed

+52
-33
lines changed

.github/workflows/release.yaml

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ permissions:
1717

1818
jobs:
1919
goreleaser:
20-
name: Release
20+
name: Build and Release
2121
runs-on: macOS-latest
22+
outputs:
23+
gpg_fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}
2224
env:
2325
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
24-
# Needed to publish new packages to our S3-hosted APT repo
25-
AWS_ACCESS_KEY_ID: ${{ secrets.OBJECT_STORAGE_ACCESS_KEY_ID }}
26-
AWS_SECRET_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_SECRET_ACCESS_KEY }}
2726
steps:
2827
- name: Checkout
2928
uses: actions/checkout@v4
@@ -61,11 +60,6 @@ jobs:
6160
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
6261
SIGNING_CERTIFICATE_BASE64: ${{ secrets.APPLICATION_ID_CERT }}
6362
AUTHKEY_BASE64: ${{ secrets.APPLE_API_KEY }}
64-
# aptly version 1.6.0 results in an segmentation fault. Therefore we fall back to version 1.5.0.
65-
# Since it is not possible to specify a version via brew command a formula was added for aptly 1.5.0
66-
# (source: https://github.com/Homebrew/homebrew-core/pull/202415/files)
67-
- name: Install Aptly version 1.5.0
68-
run: brew install aptly.rb
6963
- name: Install Snapcraft
7064
uses: samuelmeuli/action-snapcraft@v3
7165
- name: Run GoReleaser
@@ -75,26 +69,60 @@ jobs:
7569
env:
7670
GITHUB_TOKEN: ${{ secrets.CLI_RELEASE }}
7771
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
78-
- name: Setup Docker with Colima
72+
- name: Upload dist artifacts
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: dist
76+
path: dist/
77+
retention-days: 1
78+
79+
publish-packages:
80+
name: Publish Packages
81+
runs-on: ubuntu-latest
82+
needs: goreleaser
83+
if: contains(github.ref_name, '-') == false
84+
env:
85+
AWS_ACCESS_KEY_ID: ${{ secrets.OBJECT_STORAGE_ACCESS_KEY_ID }}
86+
AWS_SECRET_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_SECRET_ACCESS_KEY }}
87+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
88+
GPG_PRIVATE_KEY_FINGERPRINT: ${{ needs.goreleaser.outputs.gpg_fingerprint }}
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
with:
93+
fetch-depth: 0
94+
- name: Import GPG key
95+
uses: crazy-max/ghaction-import-gpg@v6
96+
id: import_gpg
97+
with:
98+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
99+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
100+
# aptly version 1.6.0 results in an segmentation fault. Therefore we fall back to version 1.5.0.
101+
# Since it is not possible to specify a version via brew command a formula was added for aptly 1.5.0
102+
# (source: https://github.com/Homebrew/homebrew-core/pull/202415/files)
103+
- name: Install Aptly version 1.5.0
104+
run: |
105+
# Install aptly on Ubuntu
106+
wget -O - https://www.aptly.info/pubkey.txt | apt-key add -
107+
echo "deb https://repo.aptly.info/ squeeze main" | tee -a /etc/apt/sources.list.d/aptly.list
108+
apt-get update
109+
apt-get install -y aptly
110+
- name: Install createrepo_c
79111
run: |
80-
# Install Docker CLI
81-
brew install docker
82-
# Install Colima
83-
brew install colima
84-
# Start Colima
85-
colima start --cpu 2 --memory 4 --disk 20
86-
# Verify Docker is working
87-
docker --version
88-
docker info
89-
echo "Docker is ready!"
112+
# Install createrepo_c on Ubuntu
113+
sudo apt-get update
114+
sudo apt-get install -y createrepo-c
115+
- name: Download dist artifacts
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: dist
119+
path: dist/
90120
- name: Publish packages to APT repo
91-
if: contains(github.ref_name, '-') == false
92121
env:
93122
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
94123
GPG_PRIVATE_KEY_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
95124
run: ./scripts/publish-apt-packages.sh
96125
- name: Publish packages to RPM repo
97-
if: contains(github.ref_name, '-') == false
98126
env:
99127
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
100128
GPG_PRIVATE_KEY_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

scripts/publish-rpm-packages.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,9 @@ aws s3 sync s3://${RPM_BUCKET_NAME}/${RPM_REPO_PATH}/RPMS/ ${TEMP_DIR}/rpm-repo/
3333
printf "\n>>> Adding new packages to local repo \n"
3434
cp ${GORELEASER_PACKAGES_FOLDER}/*.rpm ${TEMP_DIR}/rpm-repo/RPMS/
3535

36-
# Create RPM repository metadata using createrepo_c in Docker
36+
# Create RPM repository metadata using createrepo_c
3737
printf "\n>>> Creating RPM repository metadata \n"
38-
docker run --rm \
39-
-v "${TEMP_DIR}/rpm-repo:/repo" \
40-
fedora:latest \
41-
bash -c "
42-
# Install createrepo_c
43-
dnf install -y createrepo_c
44-
45-
# Create repository metadata
46-
createrepo_c /repo
47-
"
38+
createrepo_c ${TEMP_DIR}/rpm-repo
4839

4940
# Sign the repository metadata using the same GPG key as APT
5041
if [ -n "$GPG_PRIVATE_KEY_FINGERPRINT" ] && [ -n "$GPG_PASSPHRASE" ]; then

0 commit comments

Comments
 (0)