Merge branch 'master' of https://github.com/PartTimeLegend/hammy-mcha… #2
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 and Publish Docker Image | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILD_DATE: ${{ github.event.head_commit.timestamp }} | ||
IMAGE_NAME: hammy-mchamilton | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 # Check out your repository's code | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Generate build number tag | ||
id: generate_tag | ||
run: echo ::set-output name=tag::${GITHUB_RUN_NUMBER} | ||
- name: Convert repository owner to lowercase | ||
run: echo "::set-env name=REPOSITORY_OWNER::${{ github.repository_owner | lower }}" | ||
Check failure on line 35 in .github/workflows/docker.yml GitHub Actions / Build and Publish Docker ImageInvalid workflow file
|
||
- name: Build the Docker image | ||
run: docker build --file Dockerfile --tag ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:${{ steps.generate_tag.outputs.tag }} --tag ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:latest --build-arg BUILD_DATE=${BUILD_DATE} . | ||
- name: Push the Docker image to GitHub Container Registry | ||
run: docker push ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:${{ steps.generate_tag.outputs.tag }} && docker push ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:latest |