Skip to content

Commit

Permalink
Push docker image to registries
Browse files Browse the repository at this point in the history
  • Loading branch information
tenjaa committed Jul 21, 2021
1 parent ed4bb10 commit f46dac7
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 21 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
on: [push, pull_request]
name: CI
jobs:
test:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Install Task
run: curl -sL https://taskfile.dev/install.sh | sh
- name: Run CI Task
run: ./bin/task ci
build:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Checkout code
uses: actions/checkout@v2
- name: Install Task
run: curl -sL https://taskfile.dev/install.sh | sh
- name: Build docker image
run: ./bin/task docker
- name: Save image
run: |
docker save teliaoss/github-pr-resource:dev > github-pr-resource.tar
- name: Pass image to next job
uses: actions/upload-artifact@v2
with:
name: image
path: github-pr-resource.tar
release:
needs: [build]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: image
- run: |
docker load < github-pr-resource.tar
- uses: docker/[email protected]
with:
username: tenjaa
password: ${{ secrets.docker_password }}
- name: Login to Public ECR
uses: docker/[email protected]
with:
registry: public.ecr.aws
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update latest tag
run: |
docker tag teliaoss/github-pr-resource:dev tenjaa/github-pr-resource:latest
docker tag teliaoss/github-pr-resource:dev public.ecr.aws/f1s7y4s6/github-pr-resource:latest
docker tag teliaoss/github-pr-resource:dev ghcr.io/tenjaa/github-pr-resource:latest
docker push tenjaa/github-pr-resource:latest
docker push public.ecr.aws/f1s7y4s6/github-pr-resource:latest
docker push ghcr.io/tenjaa/github-pr-resource:latest
21 changes: 0 additions & 21 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit f46dac7

Please sign in to comment.