Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 14 additions & 63 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,72 +23,23 @@ jobs:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: metacpan
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Build test image
id: docker-build-test
uses: docker/build-push-action@v6
with:
target: test
push: false
load: true
- name: Run Perl tests
run: docker run -i ${{ steps.docker-build-test.outputs.imageid }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/${{ github.repository }}
ghcr.io/${{ github.repository }}
flavor: |
latest=false
tags: |
type=sha,format=long,priority=2000,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
- name: Find tag names
id: find-tag-names
env:
DOCKER_META_JSON: ${{ steps.meta.outputs.json }}
run: |
echo "$DOCKER_META_JSON" | jq -r '.tags | reverse | map ( { (split(":")[-1]) : . }) | add | keys[] as $k | "\($k)=\(.[$k])"' >> "$GITHUB_OUTPUT"
- uses: metacpan/metacpan-actions/docker-build-push@master
id: build-push
with:
docker_hub_username: ${{ secrets.DOCKER_HUB_USER }}
docker_hub_password: ${{ secrets.DOCKER_HUB_TOKEN }}
ghcr_username: ${{ github.repository_owner }}
ghcr_password: ${{ secrets.GITHUB_TOKEN }}
test-target: test
- name: Update deployed image
if: steps.find-tag-names.outputs.latest
uses: benc-uk/workflow-dispatch@v1
uses: metacpan/metacpan-actions/update-deployed-tag:master
with:
repo: metacpan/metacpan-k8s
ref: main
workflow: set-image.yml
token: ${{ steps.app-token.outputs.token }}
inputs: |
{
"app": "web",
"environment": "prod",
"base-tag": "${{ steps.find-tag-names.outputs.latest }}",
"tag": "${{ fromJSON(steps.meta.outputs.json).tags[0] }}"
}
token:
app: web
environment: prod
base-tag: ${{ steps.find-tag-names.outputs.latest }}
tag: ${{ steps.find-tag-names.outputs.sha }}
Loading