From c8b45d6e11905bda0eaa72e52280e478ba094e5c Mon Sep 17 00:00:00 2001 From: point-c <154027174+point-c@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:18:54 -0400 Subject: [PATCH] organized workflows --- .github/workflows/coverage.yml | 21 +++++++++++++++++++ .github/workflows/{docker.yml => release.yml} | 17 +++++++++++++-- .github/workflows/{go.yml => tests.yml} | 2 +- Dockerfile | 7 +++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/coverage.yml rename .github/workflows/{docker.yml => release.yml} (89%) rename .github/workflows/{go.yml => tests.yml} (98%) create mode 100644 Dockerfile diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..a891895 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,21 @@ +name: Coverage + +on: + workflow_run: + workflows: [Tests] + branches: [main] + types: + - completed + +jobs: + tests-passed: + runs-on: ubuntu-latest + if: | + ${{ github.event.workflow_run.conclusion == 'success' }} && + github.event_name == 'push' + steps: + - name: Coverage report + uses: ncruces/go-coverage-report@v0.3.0 + with: + chart: true + amend: true \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/release.yml similarity index 89% rename from .github/workflows/docker.yml rename to .github/workflows/release.yml index 1d7790c..90f46f4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,11 @@ name: Create and publish a Docker image # Configures this workflow to run every time a change is pushed to the branch called `release`. on: - push: - branches: ['main'] + workflow_run: + workflows: [Tests] + branches: [main] + types: + - completed # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -15,6 +18,9 @@ env: jobs: build-and-push-image: runs-on: ubuntu-latest + if: | + ${{ github.event.workflow_run.conclusion == 'success' }} && + github.event_name == 'push' # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. permissions: contents: read @@ -25,6 +31,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + # increment version + - name: Get next version + uses: reecetech/version-increment@2024.4.3 + id: version + with: + scheme: semver + increment: patch # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 diff --git a/.github/workflows/go.yml b/.github/workflows/tests.yml similarity index 98% rename from .github/workflows/go.yml rename to .github/workflows/tests.yml index 24be126..893914c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Go +name: Tests on: push: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c5e4da4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM caddy:2.7.6-builder AS builder + +RUN xcaddy build \ + --with github.com/point-c/caddy/module@v0.1.2 +FROM caddy:2.7.6 + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy