diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index a462364b..efade527 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -4,10 +4,12 @@ on: release: types: [published] +env: + IMAGE_NAME: bankofai/docs + jobs: build-and-publish: runs-on: ubuntu-latest - environment: release permissions: id-token: write contents: read @@ -16,20 +18,34 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org/" - - - name: Install dependencies - run: yarn install --frozen-lockfile + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Run lint - run: yarn lint + - name: Log in to Docker Hub + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + run: | + echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - - name: Build project - run: yarn build + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest - - name: Publish to npm - run: npm publish --access public --provenance + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + APP_ENV=production + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: linux/amd64