Add file to build images #1
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
# Build image to GitHub Packages | ||
name: Building Docker containers | ||
# Triggers the workflow on push events | ||
on: | ||
push: | ||
paths-ignore: | ||
- 'ansible/**' | ||
- 'kubernetes/**' | ||
- 'nginx/**' | ||
- 'terraform/**' | ||
jobs: | ||
initial-notification: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Initial notification | ||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 | ||
env: | ||
SLACK_MESSAGE: 'Publishing image to GitHub Packages' | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
MSG_MINIMAL: true | ||
push-image-to-github: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
final-notification: | ||
runs-on: ubuntu-latest | ||
needs: [push_image_to_dockerhub, push_image_to_github] | ||
Check failure on line 60 in .github/workflows/main.yml GitHub Actions / Building Docker containersInvalid workflow file
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Final notification | ||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 | ||
env: | ||
SLACK_MESSAGE: 'New image pushed to GitHub Packages' | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
MSG_MINIMAL: true |