|
| 1 | +name: Deploy image to DockerHub and GitHub Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build_and_release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Set up Git repository |
| 14 | + uses: actions/checkout@v2 |
| 15 | + with: |
| 16 | + submodules: true # Checkout submodules |
| 17 | + |
| 18 | + - name: Set up Docker Buildx |
| 19 | + uses: docker/setup-buildx-action@v1 |
| 20 | + |
| 21 | + - name: Log in to Docker Hub |
| 22 | + uses: docker/login-action@v1 |
| 23 | + with: |
| 24 | + username: c2sm |
| 25 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 26 | + |
| 27 | + - name: Build and Save Docker image |
| 28 | + id: build_docker_image |
| 29 | + uses: docker/build-push-action@v2 |
| 30 | + with: |
| 31 | + context: . |
| 32 | + file: ./Dockerfile |
| 33 | + push: true |
| 34 | + tags: c2sm/probtest:${{ github.ref_name }} |
| 35 | + platforms: linux/amd64,linux/arm64 |
| 36 | + outputs: type=oci,dest=probtest_image.tar |
| 37 | + |
| 38 | + - name: Upload Docker image as artifact |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: probtest_image.tar |
| 42 | + path: probtest_image.tar |
| 43 | + |
| 44 | + - name: Get release |
| 45 | + id: get_release |
| 46 | + uses: bruceadams/get-release@v1.3.2 |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ github.token }} |
| 49 | + |
| 50 | + - name: Upload Release Asset |
| 51 | + id: upload-release-asset |
| 52 | + uses: actions/upload-release-asset@v1 |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + with: |
| 56 | + upload_url: ${{ steps.get_release.outputs.upload_url }} |
| 57 | + asset_path: probtest_image.tar |
| 58 | + asset_name: probtest_image.tar |
| 59 | + asset_content_type: application/x-tar |
0 commit comments