Skip to content

Added boilerplate content. #1

Added boilerplate content.

Added boilerplate content. #1

Workflow file for this run

name: Release
concurrency:
group: release-${{ github.repository }}
on:
pull_request:
branches:
- main
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
fetch-depth: 1
path: .
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Build/load image
uses: docker/build-push-action@v4
with:
context: .
file: ./Containerfile
push: false
load: true
tags: "container-ansible:test"
- name: Run image
working-directory: .
run: |
docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro container-ansible:test
- name: Test image
working-directory: .
run: |
docker exec --tty test-container env TERM=xterm ansible --version
release:
name: Release
runs-on: ubuntu-latest
needs:
- test
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
permissions:
contents: read
packages: write
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
fetch-depth: 1
path: .
- name: Log in to GitHub CR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: metadata
name: Gather image metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Release image
uses: docker/build-push-action@v4
with:
context: .
file: ./Containerfile
push: true
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}