chore(deps): update actions/checkout action to v4 #60
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 Docker | |
env: | |
ANSIBLE_VERSION: 7.5.0-r0 | |
on: | |
push: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
name/app | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Build & Push docker image | |
id: build_docker | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: | | |
ANSIBLE_VERSION=${{ env.ANSIBLE_VERSION }} | |
push: false | |
- name: Create Release | |
id: create_release | |
if: github.ref == 'refs/heads/main' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: 1.0.${{ github.run_number }}-ansible-${{ env.ANSIBLE_VERSION }} | |
name: Release v1.0.${{ github.run_number }} | |
body: | | |
Image v1.0.${{ github.run_number }} | |
Ansible Version : ${{ env.ANSIBLE_VERSION }} | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docker image release | |
id: push_docker_release | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: | | |
ANSIBLE_VERSION=${{ env.ANSIBLE_VERSION }} | |
push: true | |
tags: cnieg/ansible:1.0.${{ github.run_number }}-ansible-${{ env.ANSIBLE_VERSION }} | |
labels: ${{ steps.meta.outputs.labels }} |