Merge pull request #159 from buluma/dependabot/pip/yamllint-approx-eq… #1493
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 Push Container | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '25 10 * * *' | |
workflow_dispatch: | |
inputs: | |
debug: | |
type: boolean | |
required: false | |
default: 'false' | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
# Set the access for individual scopes, or use permissions: write-all | |
permissions: | |
pull-requests: write | |
issues: write | |
repository-projects: write | |
jobs: | |
# Test the image builds and works correctly. | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test building image. | |
run: docker build -t docker-test . | |
- name: Run the built image. | |
run: docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro docker-test | |
# If on master branch, build and release image. | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image. | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
file: Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
buluma/github-action-molecule:latest, buluma/github-action-molecule:5.0.9 | |
ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:5.0.9 |