-
Notifications
You must be signed in to change notification settings - Fork 7
Automate releases with GitHub Actions and repogen package publishing #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e7a6907
feat(nfpms): add file name templates and APK signing for platform and…
a551f88
feat(goreleaser): sign APK and RPM packages
e092633
feat(installer): make installer POSIX compatible and use the new pack…
a02b207
feat(make): add check for needed environment variables and a non-sign…
3778b93
feat(repogen): add a script for uploading the packages using repogen
6cc8a2b
feat(ci): add workflow to publish releases when a new tag is created
158cd9a
fix(ci): run releases within the production environment
8eee03e
feat(docs): update documentation on releases
5ce4ade
fix(ci): run CI on correct branch for snapshots
026d178
fix: remove NFPM_ prefix from all env vars
2c4e4b0
feat(make): better caching for repogen and goreleaesr
88d16d8
fix(make): always download ca certs
fb6e3c5
fix(docs): installation instructions to point to new packages and Ups…
29580d4
Apply suggestion from @Copilot
pjcdawkins ca814aa
fix: remove Platform.sh installer
b07e576
fix: remove release on branch push
62bfe09
fix: address security and code review findings
pjcdawkins 52c2fcd
fix(docs): remove references to the Platform.sh compatibility CLI
374d7a5
fix: remove '|| true' from package copy commands for better error han…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| environment: production | ||
|
|
||
| steps: | ||
| - name: Check out repository code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: ./go.mod | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: "8.4" | ||
| extensions: curl, openssl, phar, zlib | ||
| tools: composer:v2 | ||
|
|
||
| - name: Get Composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(cd legacy && composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Cache Composer dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ steps.composer-cache.outputs.dir }} | ||
| key: ${{ runner.os }}-composer-${{ hashFiles('legacy/composer.lock') }} | ||
| restore-keys: ${{ runner.os }}-composer- | ||
|
|
||
| - name: Install legacy dependencies | ||
| run: cd legacy && composer install --no-interaction | ||
|
|
||
| - name: Get PHP version from Makefile | ||
| id: php-version | ||
| run: echo "version=$(grep '^PHP_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Get tool versions from Makefile | ||
| id: tool-versions | ||
| run: | | ||
| echo "goreleaser=$(grep '^GORELEASER_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT | ||
| echo "repogen=$(grep '^REPOGEN_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Cache PHP binaries | ||
| uses: actions/cache@v4 | ||
| id: php-cache | ||
| with: | ||
| path: internal/legacy/archives/php_* | ||
| key: php-binaries-${{ steps.php-version.outputs.version }} | ||
|
|
||
| - name: Download all PHP binaries | ||
| if: steps.php-cache.outputs.cache-hit != 'true' | ||
| run: make download-php | ||
|
|
||
| - name: Write signing keys to files | ||
| id: signing-keys | ||
| run: | | ||
|
pjcdawkins marked this conversation as resolved.
|
||
| KEY_DIR=$(mktemp -d) | ||
| echo "key_dir=$KEY_DIR" >> $GITHUB_OUTPUT | ||
| echo "${{ secrets.RSA_SIGNING_KEY }}" > "$KEY_DIR/rsa-signing-key.pem" | ||
| chmod 600 "$KEY_DIR/rsa-signing-key.pem" | ||
| openssl rsa -in "$KEY_DIR/rsa-signing-key.pem" -pubout -out "$KEY_DIR/rsa-signing-key.pub" | ||
| echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 -d > "$KEY_DIR/gpg-signing-key.asc" | ||
| chmod 600 "$KEY_DIR/gpg-signing-key.asc" | ||
|
|
||
| - name: Cache Go binaries | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/go/bin | ||
| key: ${{ runner.os }}-go-bin-goreleaser-${{ steps.tool-versions.outputs.goreleaser }}-repogen-${{ steps.tool-versions.outputs.repogen }} | ||
|
|
||
| - name: Install Go tools | ||
| run: make goreleaser repogen | ||
|
|
||
| - name: Build release (tag) | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| RSA_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem | ||
| GPG_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc | ||
| CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | ||
| run: make release | ||
|
|
||
| - name: Build snapshot (branch) | ||
| if: "!startsWith(github.ref, 'refs/tags/')" | ||
| env: | ||
| RSA_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem | ||
| GPG_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc | ||
| run: make snapshot | ||
|
|
||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: eu-west-1 | ||
|
|
||
| - name: Upload packages to repository | ||
| env: | ||
| GPG_PRIVATE_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc | ||
| RSA_PRIVATE_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem | ||
| RSA_PUBLIC_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pub | ||
| run: bash ./repogen.sh | ||
|
|
||
| - name: Clean up signing keys | ||
| if: always() | ||
| run: | | ||
| rm -rf "${{ steps.signing-keys.outputs.key_dir }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.