■ ■ ■ ■ ■ ■
.github/workflows/dockerhub-push.yml
| 1 | + | name: 🌥 Docker Push |
| 2 | + | |
| 3 | + | on: |
| 4 | + | workflow_run: |
| 5 | + | workflows: ["🎉 Release Binary"] |
| 6 | + | types: |
| 7 | + | - completed |
| 8 | + | workflow_dispatch: |
| 9 | + | |
| 10 | + | jobs: |
| 11 | + | docker: |
| 12 | + | runs-on: ubuntu-latest |
| 13 | + | steps: |
| 14 | + | - name: Git Checkout |
| 15 | + | uses: actions/checkout@v3 |
| 16 | + | |
| 17 | + | - name: Get Github tag |
| 18 | + | id: meta |
| 19 | + | run: | |
| 20 | + | echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/hktalent/scan4all/releases/latest" | jq -r .tag_name)" |
| 21 | + | |
| 22 | + | - name: Set up QEMU |
| 23 | + | uses: docker/setup-qemu-action@v2 |
| 24 | + | |
| 25 | + | - name: Set up Docker Buildx |
| 26 | + | uses: docker/setup-buildx-action@v2 |
| 27 | + | |
| 28 | + | - name: Login to DockerHub |
| 29 | + | uses: docker/login-action@v2 |
| 30 | + | with: |
| 31 | + | username: ${{ secrets.DOCKER_USERNAME }} |
| 32 | + | password: ${{ secrets.DOCKER_TOKEN }} |
| 33 | + | |
| 34 | + | - name: Build and push |
| 35 | + | uses: docker/build-push-action@v3 |
| 36 | + | with: |
| 37 | + | context: . |
| 38 | + | platforms: linux/amd64 |
| 39 | + | push: true |
| 40 | + | tags: hktalent/scan4all:latest,hktalent/scan4all:${{ steps.meta.outputs.tag }} |