Merge pull request #8 from golangsrilanka/feature/uber-go-fx #5
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: GitHub Registry Image Push | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: | |
- ubuntu-latest | |
env: | |
SERVICE_NAME: ghcr.io/golangsrilanka/go-puso | |
CONTAINER_REGISTRY: ghcr.io | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Version | |
id: event-version | |
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build the Docker image | |
run: docker build --tag ${SERVICE_NAME}:latest --file Dockerfile . | |
- name: GitHub Image Push | |
run: docker push $SERVICE_NAME:latest |