From 8742333dd3f04f09748b255e325debf34391c825 Mon Sep 17 00:00:00 2001 From: jhot Date: Fri, 15 Sep 2023 12:06:34 -0600 Subject: [PATCH] Initial workflow --- .forgejo/workflows/build.yaml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .forgejo/workflows/build.yaml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..325d3a5 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,42 @@ +on: + push: + branches: + - main + tags: + - v[0-9]* + pull_request: + branches: + - main + +jobs: + build_and_test: + runs_on: docker + steps: + - name: Checkout + uses: https://code.forgejo.org/actions/checkout@v4 + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + - name: Docker metadata + id: meta + uses: https://github.com/docker/metadata-action@v5 + with: + images: name/app + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: https://github.com/docker/login-action@v3 + with: + registry: code.jhot.me + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}