From c634066d694a5cd39c42337f68d9aa7c34de5fc2 Mon Sep 17 00:00:00 2001 From: miwr Date: Mon, 7 Apr 2025 12:58:47 +0200 Subject: [PATCH] deploy.yaml added --- .forgejo/workflows/deploy.yaml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .forgejo/workflows/deploy.yaml diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml new file mode 100644 index 0000000..b1bfc1e --- /dev/null +++ b/.forgejo/workflows/deploy.yaml @@ -0,0 +1,55 @@ +name: Docker Build and Push + +on: + push: + branches: + - main + paths: + - 'Dockerfile' + - '**/*.{ts,html,scss,json}' + - 'package*.json' + - 'angular.json' + - 'nginx.conf' + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker Login to Forgejo Registry + uses: docker/login-action@v3 + with: + registry: ${{ forgejo.instance_url }}/packages/${{ github.repository_owner }}/${{ github.repository }} + username: ${{ github.repository_owner }} + password: ${{ secrets.FORGEJO_PACKAGE_REGISTRY_TOKEN }} + + - name: Build and Push Docker Image + id: docker_build_push + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + tags: ${{ forgejo.instance_url }}/packages/${{ github.repository_owner }}/${{ github.repository }}:${{ github.sha }} + labels: | + org.opencontainers.image.title=${{ github.repository }} + org.opencontainers.image.version=${{ github.sha }} + org.opencontainers.image.created=${{ github.event.inputs.timestamp }} + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} + org.opencontainers.image.revision=${{ github.sha }} + + - name: Echo Image Details + run: | + echo "Docker image built and pushed to:" + echo "${{ steps.docker_build_push.outputs.digest }}" + echo "${{ steps.docker_build_push.outputs.tags }}" \ No newline at end of file