Fix build -- don't use latest for final, use ubuntu 22.04 #38
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 CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
create: | |
tags: | |
- 'v*' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Registry login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: t4l3nt/t4l3nt | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr,suffix=-{{sha}} | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Outputs | |
run: | | |
echo "The name:tag of the Docker Image is: ${{ steps.meta.outputs.tags }}" | |
echo "The labels are ${{ steps.meta.outputs.labels }}" | |
- name: Comment on PR | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'The latest docker name:tag for this PR is ***${{ steps.meta.outputs.tags }}*** :whale: :ship:' | |
}) |