-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modify action to build and consume container
To speed things up further, we can build and release the actual container on release publication, and then have the action itself consume the image instead of the Dockerfile. Additionally, we can force the release process to use the latest set of changes by defining a local GHA that uses the Dockerfile instead. I've proven this works at https://github.com/weierophinney/test-local-action/, where I observed that the build happens relative to the checkout directory, and not to where the action is defined. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
- Loading branch information
1 parent
259ad12
commit 98bf124
Showing
4 changed files
with
73 additions
and
6 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,20 @@ | ||
# Definition of the github action | ||
# as per https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
|
||
name: 'laminas/automatic-releases' | ||
description: 'Automates automatic releases for semver-compliant repositories' | ||
|
||
inputs: | ||
command-name: | ||
description: | | ||
Command to execute: one of | ||
* `laminas:automatic-releases:release` | ||
* `laminas:automatic-releases:create-merge-up-pull-request` | ||
* `laminas:automatic-releases:switch-default-branch-to-next-minor` | ||
required: true | ||
|
||
runs: | ||
using: 'docker' | ||
image: '../../../Dockerfile' | ||
args: | ||
- ${{ inputs.command-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
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,47 @@ | ||
name: Build and push containers | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
tags: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tags: ${{ steps.tags.outputs.tags }} | ||
steps: | ||
- name: Compile tag list | ||
id: tags | ||
run: | | ||
TAG=${GITHUB_REF/refs\/tags\//} | ||
PREFIX=ghcr.io/laminas/automatic-releases | ||
MAJOR="${PREFIX}:$(echo ${TAG} | cut -d. -f1)" | ||
MINOR="${MAJOR}.$(echo ${TAG} | cut -d. -f2)" | ||
PATCH="${PREFIX}:${TAG}" | ||
echo "::set-output name=tags::${MAJOR}%0A${MINOR}%0A${PATCH}" | ||
release-container: | ||
runs-on: ubuntu-latest | ||
needs: [tags] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.CONTAINER_USERNAME }} | ||
password: ${{ secrets.CONTAINER_PAT }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ needs.tags.outputs.tags }} | ||
|
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