diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23d0343..826aac0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,11 +48,6 @@ jobs: uses: actions/checkout@v2 - name: Hermit run: ./bin/hermit env -r >> $GITHUB_ENV - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 @@ -62,7 +57,7 @@ jobs: with: context: ./ file: ./Dockerfile - push: ${{ github.ref == 'refs/heads/main' }} + push: false tags: cashapp/cmmc:${{ github.sha }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..956c5c1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + release: + types: + - published + +jobs: + push_to_registry: + name: Push to DockerHub + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Hermit + run: ./bin/hermit env -r >> $GITHUB_ENV + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v3.6.0 + with: + images: cashapp/cmmc + tags: | + type=semver,pattern=v{{version}} + - name: Build and push Docker image + id: build_push + uses: docker/build-push-action@v2.7.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Image digest + run: echo ${{ steps.build_push.outputs.digest }}