Merge pull request #23 from redhat-nfvpe/update-go #11
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
name: Image push for master | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
push-amd64: | |
name: Image push/amd64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
if: github.repository_owner == 'redhat-nfvpe' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push container image | |
if: github.repository_owner == 'redhat-nfvpe' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}:latest-amd64 | |
ghcr.io/${{ github.repository }}:snapshot-amd64 | |
file: Dockerfile | |
push-origin: | |
name: Image push/origin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
if: github.repository_owner == 'k8snetworkplumbingwg' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push container image | |
if: github.repository_owner == 'k8snetworkplumbingwg' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}:latest-origin | |
ghcr.io/${{ github.repository }}:snapshot-origin | |
file: Dockerfile.openshift | |
push-manifest: | |
needs: [push-amd64] | |
runs-on: ubuntu-latest | |
env: | |
REPOSITORY: ghcr.io/${{ github.repository }} | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
if: github.repository_owner == 'redhat-nfvpe' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest for multi-arch images | |
if: github.repository_owner == 'redhat-nfvpe' | |
run: | | |
# snapshot | |
# get artifacts from previous steps | |
docker pull ${{ env.REPOSITORY }}:snapshot-amd64 | |
docker manifest create ${{ env.REPOSITORY }}:snapshot ${{ env.REPOSITORY }}:snapshot-amd64 | |
docker manifest annotate ${{ env.REPOSITORY }}:snapshot ${{ env.REPOSITORY }}:snapshot-amd64 --arch amd64 | |
docker manifest push ${{ env.REPOSITORY }}:snapshot | |
# latest | |
# get artifacts from previous steps | |
docker pull ${{ env.REPOSITORY }}:latest-amd64 | |
docker manifest create ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64 | |
docker manifest annotate ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64 --arch amd64 | |
docker manifest push ${{ env.REPOSITORY }}:latest |