From 073d33e12f58547fd794a41b23a7c6bba4eda522 Mon Sep 17 00:00:00 2001 From: Traines Date: Tue, 17 Dec 2024 23:06:20 +0000 Subject: [PATCH] ci release --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++------ Dockerfile | 2 +- package.json | 2 +- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c92f0312..d5501a0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,20 +2,46 @@ name: Build NPM Package & Docker on: push: - branches: [ "main" ] + branches: [ "release" ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: test: name: test uses: './.github/workflows/test.yml' - build-docker: - needs: [test] + build-and-push-docker: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag db-vendo-client:6 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + id: push + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} build-pkg: needs: [test] diff --git a/Dockerfile b/Dockerfile index ee1080a6..b9ab47b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL org.opencontainers.image.description="A clean REST API wrapping around the LABEL org.opencontainers.image.authors="Traines " LABEL org.opencontainers.image.documentation="https://github.com/public-transport/db-vendo-client" LABEL org.opencontainers.image.source="https://github.com/public-transport/db-vendo-client" -LABEL org.opencontainers.image.revision="6.0.0" +LABEL org.opencontainers.image.version="6.0.0" LABEL org.opencontainers.image.licenses="ISC" WORKDIR /app diff --git a/package.json b/package.json index 8f997165..556b9bf4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "db-vendo-client", + "name": "@public-transport/db-vendo-client", "description": "Client for bahn.de public transport APIs.", "version": "6.0.0", "type": "module",