-
Notifications
You must be signed in to change notification settings - Fork 3
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
2 changed files
with
104 additions
and
0 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,99 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "Dockerfile" | ||
concurrency: | ||
# Support push/pr as event types with different behaviors each: | ||
# 1. push: queue up builds | ||
# 2. pr: only allow one run per PR | ||
group: ${{ github.workflow }}-${{ github.event_name }}${{ github.event.pull_request.number }} | ||
# If there is already a workflow running for the same pull request, cancel it | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
env: | ||
AWS_REGION: "eu-central-1" | ||
jobs: | ||
build: | ||
name: "Build image: ${{ matrix.images.name }}" | ||
runs-on: | ||
group: ubuntu-runners | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
images: | ||
- name: github-actions-runner | ||
dockerfile: ./Dockerfile | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ steps.login-ecr.outputs.registry }}/${{ matrix.images.name }} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=sha | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build, tag and cache the image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ${{ matrix.images.dockerfile }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
outputs: type=docker,dest=/tmp/image-${{ matrix.images.name }}.tar | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: image-${{ matrix.images.name }} | ||
path: /tmp/image-${{ matrix.images.name }}.tar | ||
|
||
publish: | ||
needs: [tests, build, cargo-deny] | ||
name: "Publish image: ${{ matrix.images.name }}" | ||
runs-on: | ||
group: ubuntu-runners | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
images: | ||
- name: github-actions-runner | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-${{ matrix.images.name }} | ||
path: /tmp | ||
- name: Push the image to ECR | ||
run: | | ||
docker load --input /tmp/image-${{ matrix.images.name }}.tar | ||
docker image push --all-tags ${{ steps.login-ecr.outputs.registry }}/${{ matrix.images.name }} |
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,5 @@ | ||
FROM myoung34/github-runner:ubuntu-focal | ||
|
||
# modify actions runner binaries to allow custom cache server implementation | ||
# https://gha-cache-server.falcondev.io/getting-started | ||
RUN sed -i 's/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x43\x00\x41\x00\x43\x00\x48\x00\x45\x00\x5F\x00\x55\x00\x52\x00\x4C\x00/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x43\x00\x41\x00\x43\x00\x48\x00\x45\x00\x5F\x00\x4F\x00\x52\x00\x4C\x00/g' /home/runner/bin/Runner.Worker.dll |