diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..8e593fa --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,65 @@ +name: Docker Build and Push + +on: + release: + types: [created] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract version from release + id: version_tag + run: | + # Extract the version from the release tag, removing any 'v' prefix + VERSION_TAG="${GITHUB_REF#refs/tags/}" + CLEAN_VERSION=$(echo "$VERSION_TAG" | sed 's/^v//') + echo "##[set-output name=version;]${CLEAN_VERSION}" + + # Publish WinArena Base image + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./src/win-arena-container/Dockerfile-WinArena-Base + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:${{ steps.version_tag.outputs.version }} + + - name: Build and push latest + uses: docker/build-push-action@v2 + with: + context: . + file: ./src/win-arena-container/Dockerfile-WinArena-Base + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:latest + + # Publish WinArena image + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./src/win-arena-container/Dockerfile-WinArena + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/winarena:${{ steps.version_tag.outputs.version }} + + - name: Build and push latest + uses: docker/build-push-action@v2 + with: + context: . + file: ./src/win-arena-container/Dockerfile-WinArena + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/winarena:latest