Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update publish-multi-arch-container-images.yaml #90

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions .github/workflows/publish-multi-arch-container-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
# The "push" event could replace "merged" event.
push:
branches:
- master
- main
tags:
- "v*.*.*"
paths-ignore:
Expand All @@ -21,20 +21,25 @@ on:
- 'LICENSE'
- 'CODEOWNERS'
- 'assets/**'
- 'test/**'
- 'scripts/**'
- 'src/testclient/scripts/**'
- 'docs/**'

jobs:
# The job key is "publishing"
publishing:
# Job name is "Publishing"
name: Publishing

# This job runs on Ubuntu-latest
runs-on: ubuntu-18.04
if: github.repository == 'cloud-barista/cb-mapui'

# This job runs on Ubuntu-latest (Ubuntu 20.04 LTS checked on 2022-09-06)
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v2.3.4
uses: actions/checkout@v4

- name: Prepare tags
id: prep
Expand All @@ -55,50 +60,50 @@ jobs:
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*$ ]]; then
DOCKER_TAGS="$DOCKER_TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=docker-tags::${DOCKER_TAGS}
echo "docker-tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT
echo ${DOCKER_TAGS}
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
GHCR_TAGS="${GHCR_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*$ ]]; then
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:latest"
fi
echo ::set-output name=ghcr-tags::${GHCR_TAGS}
echo "ghcr-tags=${GHCR_TAGS}" >> $GITHUB_OUTPUT
echo ${GHCR_TAGS}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1.5.1
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v2.1.6
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to Docker Hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Build and publish
id: docker_build
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./
Expand Down