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: Build Docker Image | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v1 | |
- name: Login to GHCR | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Test Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: "." | |
push: false | |
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}-test | |
target: test | |
- name: Execute Tests | |
run: docker run ghcr.io/${{ github.repository }}:${{ github.ref_name }}-test | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: "." | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} |