Bump docker/build-push-action from 5.1.0 to 6.9.0 #542
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: nanosaur builder | |
# Reference: | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on | |
on: [push, workflow_dispatch] | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
docker_image_name: nanosaur/nanosaur | |
# https://github.com/docker/build-push-action | |
jobs: | |
test-pkgs: | |
name: "Test packages and version" | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs | |
outputs: | |
tag: ${{ steps.repo_status.outputs.tag }} | |
pre_release: ${{ steps.repo_status.outputs.pre_release }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout nanosaur tools repo | |
uses: actions/checkout@v4 | |
with: | |
repository: rnanosaur/nanosaur_tools | |
path: nanosaur_tools | |
- name: Repository status | |
id: repo_status | |
shell: bash | |
run: | | |
pip3 install -r nanosaur_tools/CI/requirements.txt | |
if ${{ startsWith(github.ref, 'refs/tags/') }} ; then | |
TAG_RELEASE=${GITHUB_REF/refs\/tags\//} | |
else | |
TAG_RELEASE=${GITHUB_REF/refs\/heads\//} | |
fi | |
CHECK_PRE_RELEASE=$(python3 nanosaur_tools/check_pre_release.py $TAG_RELEASE) | |
echo ::set-output name=tag::${TAG_RELEASE} | |
echo ::set-output name=pre_release::${CHECK_PRE_RELEASE} | |
echo "tag=${TAG_RELEASE}" | |
echo "pre_release=${CHECK_PRE_RELEASE}" | |
- name: Test version packages | |
if: startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
run: | | |
TAG_RELEASE=${{ steps.repo_status.outputs.tag }} | |
python3 nanosaur_tools/check_tag_version.py $TAG_RELEASE | |
echo "Check nanosaur script" | |
python3 nanosaur_tools/check_nanosaur_script.py $TAG_RELEASE | |
# https://github.com/docker/build-push-action/issues/225 | |
docker: | |
name: "Build Docker image develop" | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.docker_image_name }} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=ref,event=tag | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: github.actor != 'dependabot[bot]' | |
uses: docker/login-action@v3.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6.9.0 | |
with: | |
push: ${{ github.actor != 'dependabot[bot]' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/arm64 | |
- name: Docker Image digest | |
run: | | |
echo ${{ steps.docker_build.outputs.digest }} | |
export: | |
name: Make all artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build project | |
run: | | |
bash nanosaur_description/scripts/nanosaur_stl.sh | |
- name: upload data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: data | |
path: | | |
nanosaur-stl.zip | |
nanosaur_description/meshes/datasheet/nanosaur-powerbank.pdf | |
nanosaur_description/meshes/datasheet/nanosaur-datasheet.pdf | |
nanosaur/scripts/nanosaur | |
update_docker_description: | |
name: Update docker description | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [docker] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker Hub Description # https://github.com/peter-evans/dockerhub-description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: nanosaur/nanosaur | |
short-description: ${{ github.event.repository.description }} | |
readme-filepath: ./README.md | |
new_release: | |
name: Upload release | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [test-pkgs, export] | |
steps: | |
- name: Extract artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: data | |
- name: Release # https://github.com/softprops/action-gh-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ github.ref }} | |
name: Release ${{ needs.test-pkgs.outputs.tag }} | |
generate_release_notes: true | |
draft: false | |
prerelease: ${{ needs.test-pkgs.outputs.pre_release }} | |
files: | | |
nanosaur-stl.zip | |
nanosaur_description/meshes/datasheet/nanosaur-powerbank.pdf | |
nanosaur_description/meshes/datasheet/nanosaur-datasheet.pdf | |
nanosaur/scripts/nanosaur | |
notify: | |
name: "Notify socials" | |
needs: [test-pkgs, new_release, update_docker_description] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: '**${{ env.docker_image_name }}:${{ needs.test-pkgs.outputs.tag }}** has been deployed!' |