-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break publishing up into distinct jobs.
Signed-off-by: Nic Cope <negz@rk0n.org>
- Loading branch information
Showing
3 changed files
with
167 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
- '**.jpg' | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.14' | ||
GOLANGCI_VERSION: 'v1.31' | ||
DOCKER_BUILDX_VERSION: 'v0.4.2' | ||
|
||
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run | ||
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether | ||
# credentials have been provided before trying to run steps that need them. | ||
DOCKER_USR: ${{ secrets.DOCKER_USR }} | ||
AWS_USR: ${{ secrets.AWS_USR }} | ||
|
||
jobs: | ||
|
||
publish-artifacts: | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
version: ${{ env.DOCKER_BUILDX_VERSION }} | ||
install: true | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Fetch History | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .work/pkg | ||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-pkg- | ||
|
||
- 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: Upload Artifacts (to GitHub) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: output | ||
path: _output/** | ||
|
||
- name: Login to Docker | ||
uses: docker/login-action@v1 | ||
if: env.DOCKER_USR != '' | ||
with: | ||
username: ${{ secrets.DOCKER_USR }} | ||
password: ${{ secrets.DOCKER_PSW }} | ||
|
||
- name: Publish Artifacts (to S3 and Docker Hub) | ||
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} | ||
if: env.AWS_USR != '' && env.DOCKER_USR != '' | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} | ||
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Promote Artifacts (in S3 and Docker Hub) | ||
if: env.AWS_USR != '' && env.DOCKER_USR != '' | ||
run: make -j2 promote | ||
env: | ||
BRANCH_NAME: master | ||
CHANNEL: master | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} | ||
|
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,66 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
- '**.jpg' | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.14' | ||
DOCKER_BUILDX_VERSION: 'v0.4.2' | ||
|
||
jobs: | ||
|
||
publish-artifacts: | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
version: ${{ env.DOCKER_BUILDX_VERSION }} | ||
install: true | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Fetch History | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .work/pkg | ||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-pkg- | ||
|
||
- 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: Upload Artifacts (to GitHub) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: output | ||
path: _output/** |
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