From 97434a6f5f68274f349ab918a4f90af1bc6a08dc Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 11 Jul 2025 11:17:10 -0700 Subject: [PATCH] build: github actions --- .github/workflows/docker.yml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ .releaserc.json | 15 ++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..144e147 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,37 @@ +name: Build Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: 'Semantic version to label the Docker image under' + required: true + type: string + +jobs: + check_authorization: + name: Check authorization to publish new Docker image + runs-on: ubuntu-latest + outputs: + isAuthorized: ${{ steps.check-auth.outputs.is_authorized }} + steps: + - name: check-auth + id: check-auth + run: echo "is_authorized=${{ contains(secrets.DEPLOYMENT_AUTHORIZED_USERS, github.triggering_actor) }}" >> $GITHUB_OUTPUT + build: + name: Build Docker image + needs: check_authorization + if: needs.check_authorization.outputs.isAuthorized == 'true' + runs-on: ubuntu-latest + steps: + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: ghcr.io/crosstalk-solutions/project-nomad-admin:${{ inputs.version }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8ac66b7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release SemVer + +on: workflow_dispatch + +jobs: + check_authorization: + name: Check authorization to release new version + runs-on: ubuntu-latest + outputs: + isAuthorized: ${{ steps.check-auth.outputs.is_authorized }} + steps: + - name: check-auth + id: check-auth + run: echo "is_authorized=${{ contains(secrets.DEPLOYMENT_AUTHORIZED_USERS, github.triggering_actor) }}" >> $GITHUB_OUTPUT + release: + name: Release + needs: check_authorization + if: needs.check_authorization.outputs.isAuthorized == 'true' + runs-on: ubuntu-latest + outputs: + didRelease: ${{ steps.semver.outputs.new_release_published }} + newVersion: ${{ steps.semver.outputs.new_release_version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: semantic-release + uses: cycjimmy/semantic-release-action@v3 + id: semver + env: + GITHUB_TOKEN: ${{ secrets.COSMISTACKBOT_ACCESS_TOKEN }} + GIT_AUTHOR_NAME: cosmistack-bot + GIT_AUTHOR_EMAIL: dev@cosmistack.com + GIT_COMMITTER_NAME: cosmistack-bot + GIT_COMMITTER_EMAIL: dev@cosmistack.com \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..e06f66a --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,15 @@ +{ + "branches": ["master"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + ["@semantic-release/npm", { + "npmPublish": false + }], + ["@semantic-release/git", { + "assets": ["package.json"], + "message": "chore(release): ${nextRelease.version} [skip ci]" + }], + "@semantic-release/github" + ] +} \ No newline at end of file