Merge pull request #2 from kpcyrd/repro-env #50
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: Docker Image | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ "v*.*.*" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
tags: d3xs | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
UPDATE_CHECK_COMMIT=${{ github.sha }} | |
- name: Test the Docker image | |
run: | | |
docker run --rm d3xs --help | |
- name: Login to github container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push the image to `edge` | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: | | |
docker tag d3xs ghcr.io/${{ github.repository }}:edge | |
docker push ghcr.io/${{ github.repository }}:edge | |
- name: Push the image to `${{ github.ref_name }}` | |
if: github.ref_type == 'tag' | |
run: | | |
docker tag d3xs ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
- name: Push the image to `latest` | |
if: github.ref_type == 'tag' | |
run: | | |
docker tag d3xs ghcr.io/${{ github.repository }}:latest | |
docker push ghcr.io/${{ github.repository }}:latest |