Only Nagios upgrade #243
Workflow file for this run
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: Nagios Build | |
# This workflow is triggered on pushes to the repository. | |
# Taken from tutorial | |
# https://github.com/gitschooldude/hello | |
# https://www.youtube.com/watch?v=-xIXFxuZCMI | |
# https://github.com/marketplace/actions/docker-setup-buildx | |
# https://github.com/marketplace/actions/docker-login | |
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions/58034787 | |
on: [push] | |
jobs: | |
nagios-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print all github.* variables | |
id: step_one_print_all | |
run: | | |
echo "github.action : ${{ github.action }}" | |
echo "github.action_path : ${{ github.action_path }}" | |
echo "github.actor : ${{ github.actor }}" | |
echo "github.base_ref : ${{ github.base_ref }}" | |
echo 'github.event : ${{ toJson(github.event) }}' | |
echo "github.event_name : ${{ github.event_name }}" | |
echo "github.event_path : ${{ github.event_path }}" | |
echo "github.head_ref : ${{ github.head_ref }}" | |
echo "github.job : ${{ github.job }}" | |
echo "github.ref : ${{ github.ref }}" | |
echo "github.repository : ${{ github.repository }}" | |
echo "github.repository_owner : ${{ github.repository_owner }}" | |
echo "github.run_id : ${{ github.run_id }}" | |
echo "github.run_number : ${{ github.run_number }}" | |
echo "github.sha : ${{ github.sha }}" | |
echo "github.token : ${{ github.token }}" | |
echo "github.workflow : ${{ github.workflow }}" | |
echo "github.workspace : ${{ github.workspace }}" | |
echo "my docker tag: ${{ env.action_mytag }}" | |
- name: Set the value of a the Docker tag for branches other than master | |
id: step_two_branches_all | |
if: ${{ (startsWith( github.ref, 'refs/heads') == true) && (github.ref != 'refs/heads/master') }} | |
run: | | |
echo "action_mytag=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Set the value of the Docker tag for git tags | |
id: step_set_docker_tag_for_git_tags | |
if: ${{ startsWith( github.ref, 'refs/tags') == true}} | |
run: | | |
echo "action_mytag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Set the value of the Docker tag for master branch | |
id: step_branch_master | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
echo "action_mytag=latest" >> $GITHUB_ENV | |
- name: Print the Docker tag value which will be used | |
id: step_print_docker_tag | |
run: | | |
echo "My docker tag will be: ${{ env.action_mytag }}" | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- | |
name: Cache Docker layers for this Git branch | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.ref }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ github.ref }} | |
- | |
name: Docker Buildx (build and cache) | |
run: | | |
docker buildx build \ | |
--progress plain \ | |
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \ | |
--label "gitCommit=${{ github.sha }}" \ | |
--label "org.opencontainers.image.revision=${{ github.sha }}" \ | |
--tag manios/nagios:${{ env.action_mytag }} \ | |
--output "type=image,push=true" . | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect manios/nagios:${{ env.action_mytag }} |