-
Notifications
You must be signed in to change notification settings - Fork 9
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
9 changed files
with
230 additions
and
96 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,88 @@ | ||
name: Publish | ||
description: Builds and pushes the Docker image to the public ECR and GitHub registry | ||
|
||
inputs: | ||
aws_role_to_assume: | ||
description: The AWS role to assume. Used to authenticate with ECR. | ||
required: true | ||
github_token: | ||
description: The GitHub token. Used to authenticate with GitHub registry. | ||
required: true | ||
git_tag: | ||
description: Git tag to use for the GitHub Release | ||
required: false | ||
image_tags: | ||
description: The tags of the Docker image to push | ||
required: true | ||
publish_release: | ||
description: Whether to publish a GitHub Release | ||
required: true | ||
default: false | ||
release_title: | ||
description: The title of the GitHub Release. | ||
required: false | ||
release_body: | ||
description: The body of the GitHub Release. If not provided, the body will be auto-generated. | ||
required: false | ||
checkout_ref: | ||
description: The ref to checkout. If not provided, the basic checkout action will be used. | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@main | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.checkout_ref }} | ||
|
||
- name: Install the latest AWS CLI | ||
shell: sh | ||
run: | | ||
apk add --no-cache python3 py3-pip | ||
pip3 install --upgrade pip | ||
pip3 install awscli | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: us-east-1 | ||
role-to-assume: ${{ inputs.aws_role_to_assume }} | ||
role-duration-seconds: 900 | ||
|
||
- name: Log in to Amazon public ECR | ||
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws | ||
|
||
- name: Log in to GitHub registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ inputs.github_token }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: linux/arm64 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push the image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ inputs.image_tags }} | ||
|
||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
if: inputs.publish_release == 'true' | ||
with: | ||
name: ${{ inputs.release_title }} | ||
tag: ${{ inputs.git_tag }} | ||
body: ${{ inputs.release_body }} | ||
generateReleaseNotes: true | ||
allowUpdates: true |
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,32 @@ | ||
name: Deploy future tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deployment: | ||
name: Build and publish future tag | ||
runs-on: ubuntu-latest | ||
container: docker | ||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout publish workflow | ||
uses: Bhacaz/checkout-files@v2 | ||
with: | ||
files: .github/workflows/publish/action.yml | ||
|
||
- name: Build and push future image | ||
uses: ./.github/workflows/publish | ||
with: | ||
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_release: false | ||
image_tags: | | ||
${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:future | ||
ghcr.io/spacelift-io/runner-terraform:future |
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,53 @@ | ||
name: Scheduled publish | ||
|
||
on: | ||
schedule: | ||
- cron: '20 8 * * 1' | ||
|
||
jobs: | ||
deployment: | ||
name: Rebuild and publish the latest tagged image | ||
runs-on: ubuntu-latest | ||
container: docker | ||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Get latest tag | ||
uses: oprypin/find-latest-tag@v1 | ||
id: latest-tag | ||
with: | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set current date as env variable | ||
run: echo "TODAY=$(date +'%Y%m%d')" >> $GITHUB_ENV | ||
|
||
- name: Set nicely formatted current date as env variable | ||
run: echo "TODAY_FORMATTED=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
|
||
- name: Checkout publish workflow | ||
uses: Bhacaz/checkout-files@v2 | ||
with: | ||
files: .github/workflows/publish/action.yml | ||
|
||
- name: Build and push weekly image | ||
uses: ./.github/workflows/publish | ||
with: | ||
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
git_tag: ${{ steps.latest-tag.outputs.tag }} | ||
publish_release: true | ||
release_title: ${{ steps.latest-tag.outputs.tag }} - weekly release (${{ env.TODAY_FORMATTED }}) | ||
release_body: | | ||
## Weekly rebuild | ||
This is a weekly rebuild of the latest image (`${{ steps.latest-tag.outputs.tag }}`). | ||
The image is rebuilt to ensure that it is up to date with the latest security patches. | ||
checkout_ref: ${{ steps.latest-tag.outputs.tag }} | ||
image_tags: | | ||
${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:latest | ||
${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:${{ steps.latest-tag.outputs.tag }}_${{ env.TODAY }} | ||
ghcr.io/spacelift-io/runner-terraform:latest | ||
ghcr.io/spacelift-io/runner-terraform:${{ steps.latest-tag.outputs.tag }}_${{ env.TODAY }} |
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,43 @@ | ||
name: Deploy tagged | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
deployment: | ||
name: Build and publish the newly tagged image | ||
runs-on: ubuntu-latest | ||
container: docker | ||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Get latest tag | ||
uses: oprypin/find-latest-tag@v1 | ||
id: latest-tag | ||
with: | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout publish workflow | ||
uses: Bhacaz/checkout-files@v2 | ||
with: | ||
files: .github/workflows/publish/action.yml | ||
|
||
- name: Build and push latest image | ||
uses: ./.github/workflows/publish | ||
with: | ||
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
git_tag: ${{ steps.latest-tag.outputs.tag }} | ||
publish_release: true | ||
release_title: ${{ steps.latest-tag.outputs.tag }} | ||
image_tags: | | ||
${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:latest | ||
${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:${{ steps.latest-tag.outputs.tag }} | ||
ghcr.io/spacelift-io/runner-terraform:latest | ||
ghcr.io/spacelift-io/runner-terraform:${{ steps.latest-tag.outputs.tag }} |
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