Skip to content

Commit 97434a6

Browse files
committed
build: github actions
1 parent 3b81e00 commit 97434a6

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

.github/workflows/docker.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Semantic version to label the Docker image under'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
check_authorization:
13+
name: Check authorization to publish new Docker image
14+
runs-on: ubuntu-latest
15+
outputs:
16+
isAuthorized: ${{ steps.check-auth.outputs.is_authorized }}
17+
steps:
18+
- name: check-auth
19+
id: check-auth
20+
run: echo "is_authorized=${{ contains(secrets.DEPLOYMENT_AUTHORIZED_USERS, github.triggering_actor) }}" >> $GITHUB_OUTPUT
21+
build:
22+
name: Build Docker image
23+
needs: check_authorization
24+
if: needs.check_authorization.outputs.isAuthorized == 'true'
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Log in to GitHub Container Registry
28+
uses: docker/login-action@v2
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Build and push
34+
uses: docker/build-push-action@v4
35+
with:
36+
push: true
37+
tags: ghcr.io/crosstalk-solutions/project-nomad-admin:${{ inputs.version }}

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release SemVer
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
check_authorization:
7+
name: Check authorization to release new version
8+
runs-on: ubuntu-latest
9+
outputs:
10+
isAuthorized: ${{ steps.check-auth.outputs.is_authorized }}
11+
steps:
12+
- name: check-auth
13+
id: check-auth
14+
run: echo "is_authorized=${{ contains(secrets.DEPLOYMENT_AUTHORIZED_USERS, github.triggering_actor) }}" >> $GITHUB_OUTPUT
15+
release:
16+
name: Release
17+
needs: check_authorization
18+
if: needs.check_authorization.outputs.isAuthorized == 'true'
19+
runs-on: ubuntu-latest
20+
outputs:
21+
didRelease: ${{ steps.semver.outputs.new_release_published }}
22+
newVersion: ${{ steps.semver.outputs.new_release_version }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
persist-credentials: false
29+
- name: semantic-release
30+
uses: cycjimmy/semantic-release-action@v3
31+
id: semver
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.COSMISTACKBOT_ACCESS_TOKEN }}
34+
GIT_AUTHOR_NAME: cosmistack-bot
35+
GIT_AUTHOR_EMAIL: dev@cosmistack.com
36+
GIT_COMMITTER_NAME: cosmistack-bot
37+
GIT_COMMITTER_EMAIL: dev@cosmistack.com

.releaserc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"branches": ["master"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
["@semantic-release/npm", {
7+
"npmPublish": false
8+
}],
9+
["@semantic-release/git", {
10+
"assets": ["package.json"],
11+
"message": "chore(release): ${nextRelease.version} [skip ci]"
12+
}],
13+
"@semantic-release/github"
14+
]
15+
}

0 commit comments

Comments
 (0)