Skip to content

Merge pull request #8 from sue445/dependabot/github_actions/docker/me… #52

Merge pull request #8 from sue445/dependabot/github_actions/docker/me…

Merge pull request #8 from sue445/dependabot/github_actions/docker/me… #52

Workflow file for this run

name: docker-ghcr
on:
push:
tags:
- "*"
branches:
- main
# Run tests for any PRs.
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: docker compose --file docker-compose.test.yml build
- run: docker compose --file docker-compose.test.yml run sut
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/sue445/packer-serverspec
tags: |
type=edge,branch=main
type=ref,event=tag
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Slack Notification
uses: lazy-actions/slatify@master
if: always()
continue-on-error: true
with:
job_name: '*build_and_push*'
type: ${{ job.status }}
icon_emoji: ":octocat:"
url: ${{ secrets.SLACK_WEBHOOK }}
token: ${{ secrets.GITHUB_TOKEN }}