-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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 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,90 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- release-* | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
concurrency: | ||
group: ci-${{ github.ref }}-1 | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.21' | ||
DOCKER_BUILDX_VERSION: 'v0.9.1' | ||
|
||
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a | ||
# step 'if env.XXX' != ""', so we copy these to succinctly test whether | ||
# credentials have been provided before trying to run steps that need them. | ||
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} | ||
jobs: | ||
|
||
publish-artifacts: | ||
if: > | ||
github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-')) || | ||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'candidate-')) | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: ${{ env.DOCKER_BUILDX_VERSION }} | ||
install: true | ||
|
||
- name: Login to Upbound | ||
uses: docker/login-action@v3 | ||
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' | ||
with: | ||
registry: xpkg.upbound.io | ||
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} | ||
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Fetch History | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Vendor Dependencies | ||
run: make vendor vendor.check | ||
|
||
- name: Build Artifacts | ||
run: make -j2 build.all | ||
env: | ||
# We're using docker buildx, which doesn't actually load the images it | ||
# builds by default. Specifying --load does so. | ||
BUILD_ARGS: "--load" | ||
|
||
- name: Publish Artifacts to GitHub | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: output | ||
path: _output/** | ||
|
||
- name: Publish Artifacts | ||
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' | ||
run: make publish BRANCH_NAME=${GITHUB_REF##*/} |
This file contains 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