# Builds the image and pushes it to Docker Hub when a production tag (e.g. v1.1.0-prod1) is pushed. # Restarting the container on the VPS is done by hand for now. name: Build and push image on: push: tags: - 'v*-prod*' env: IMAGE: v0idf1sh/sdp-dashboard jobs: build: runs-on: self-hosted steps: - name: Check out uses: actions/checkout@v4 - name: Log in to Docker Hub env: DHUB_UNAME: ${{ secrets.DHUB_UNAME }} DHUB_PASS: ${{ secrets.DHUB_PASS }} run: echo "$DHUB_PASS" | docker login --username "$DHUB_UNAME" --password-stdin - name: Build run: | docker build \ --pull \ --label "org.opencontainers.image.version=${{ gitea.ref_name }}" \ --label "org.opencontainers.image.revision=${{ gitea.sha }}" \ -t "$IMAGE:${{ gitea.ref_name }}" \ -t "$IMAGE:latest" \ . - name: Push run: | docker push "$IMAGE:${{ gitea.ref_name }}" docker push "$IMAGE:latest" - name: Log out if: always() run: docker logout