|
46 | 46 | BUILD_DIR: ${{ github.workspace }}/build-release |
47 | 47 | run: ./scripts/package-manager-check.sh |
48 | 48 |
|
| 49 | + - name: Check Docker Hub credentials |
| 50 | + if: startsWith(github.ref, 'refs/tags/') |
| 51 | + env: |
| 52 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
| 53 | + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
| 54 | + run: | |
| 55 | + test -n "$DOCKERHUB_USERNAME" || { |
| 56 | + echo "DOCKERHUB_USERNAME is required to publish the 0state/icey-server image" >&2 |
| 57 | + exit 1 |
| 58 | + } |
| 59 | + test -n "$DOCKERHUB_TOKEN" || { |
| 60 | + echo "DOCKERHUB_TOKEN is required to publish the 0state/icey-server image" >&2 |
| 61 | + exit 1 |
| 62 | + } |
| 63 | +
|
| 64 | + - name: Derive image version |
| 65 | + if: startsWith(github.ref, 'refs/tags/') |
| 66 | + id: image_version |
| 67 | + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" |
| 68 | + |
| 69 | + - name: Set up Docker Buildx |
| 70 | + if: startsWith(github.ref, 'refs/tags/') |
| 71 | + uses: docker/setup-buildx-action@v3 |
| 72 | + |
| 73 | + - name: Log in to Docker Hub |
| 74 | + if: startsWith(github.ref, 'refs/tags/') |
| 75 | + uses: docker/login-action@v3 |
| 76 | + with: |
| 77 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 78 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 79 | + |
| 80 | + - name: Extract image metadata |
| 81 | + if: startsWith(github.ref, 'refs/tags/') |
| 82 | + id: image_meta |
| 83 | + uses: docker/metadata-action@v5 |
| 84 | + with: |
| 85 | + images: 0state/icey-server |
| 86 | + tags: | |
| 87 | + type=raw,value=${{ steps.image_version.outputs.version }} |
| 88 | + type=raw,value=latest |
| 89 | +
|
| 90 | + - name: Build and push image |
| 91 | + if: startsWith(github.ref, 'refs/tags/') |
| 92 | + uses: docker/build-push-action@v6 |
| 93 | + with: |
| 94 | + context: . |
| 95 | + file: ./docker/Dockerfile |
| 96 | + push: true |
| 97 | + build-args: | |
| 98 | + ICEY_SERVER_BINARY=build-release/src/server/icey-server |
| 99 | + ICEY_WEB_ROOT=web/dist |
| 100 | + ICEY_SAMPLE_MEDIA=icey/data/test.mp4 |
| 101 | + ICEY_ENTRYPOINT=docker/entrypoint.sh |
| 102 | + tags: ${{ steps.image_meta.outputs.tags }} |
| 103 | + labels: ${{ steps.image_meta.outputs.labels }} |
| 104 | + |
49 | 105 | - name: Upload release assets |
50 | 106 | uses: softprops/action-gh-release@v2 |
51 | 107 | if: startsWith(github.ref, 'refs/tags/') |
|
0 commit comments