Normalize caches #188
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
push: | |
branches: [main] | |
tags: [v*] | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- apps/api | |
- apps/twap | |
- apps/notification-producer | |
- apps/telegram | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn install | |
- name: Write commit hash in the assets directory | |
run: echo -n "${{ github.sha }}" > assets/git-commit-hash.txt | |
- run: yarn build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract package name | |
run: echo "PACKAGE_NAME=$(basename ${{ matrix.package }})" >> $GITHUB_ENV | |
- name: 'Image metadata for ${{ env.PACKAGE_NAME }}' | |
id: image_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/${{ env.PACKAGE_NAME }} | |
- name: 'BFF: Build and push ${{ env.PACKAGE_NAME }}' | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ matrix.package }}/Dockerfile | |
push: true | |
tags: ${{ steps.image_meta.outputs.tags }} | |
labels: ${{ steps.image_meta.outputs.labels }} | |
builder: ${{ steps.setup-buildx.outputs.name }} | |
platforms: linux/amd64 | |
- uses: cowprotocol/autodeploy-action@v2 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
images: ghcr.io/cowprotocol/bff/${{ env.PACKAGE_NAME }}:main | |
url: ${{ secrets.AUTODEPLOY_URL }} | |
token: ${{ secrets.AUTODEPLOY_TOKEN }} | |
timeout: 600000 # 10 minutes |