docker #385
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: docker | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # runs daily at 00:00 | |
release: | |
types: [published] | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU for multi-platform build | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: New commit count | |
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV | |
- name: Push nightly staging | |
if: github.ref == 'refs/heads/master' && env.NEW_COMMIT_COUNT > 0 | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:staging | |
target: scanservjs-core | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Get version | |
id: get_version | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
- name: Push release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:release-${{ steps.get_version.outputs.VERSION }} | |
${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:${{ steps.get_version.outputs.VERSION }} | |
${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:latest | |
target: scanservjs-core | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 |