Skip to content

Commit

Permalink
feat: release gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hmbanan666 committed Dec 17, 2024
1 parent ec7be41 commit aa9112d
Show file tree
Hide file tree
Showing 5 changed files with 1,471 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Docker on Release

on:
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Regex matching
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ github.ref_name }}
regex: '@chat-game\/([a-z-]+)-(v[0-9]+.[0-9]+.[0-9]+)'

- name: Exit if tag not matched
if: ${{ steps.regex-match.outputs.match == '' }}
run: |
echo "Tag was not matched"
exit 1
- name: Set APP in env
run: |
echo "APP_NAME=${{ steps.regex-match.outputs.group1 }}" >> $GITHUB_ENV
echo "APP_VERSION=${{ steps.regex-match.outputs.group2 }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ${{ matrix.package }}
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ env.APP_NAME }}/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ secrets.NAMESPACE }}/${{ env.APP_NAME }}:latest,${{ secrets.NAMESPACE }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
workflow_dispatch:
# push:
# branches:
# - main

jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
issues: write
deployments: write
pull-requests: write
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: true

- name: Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
run: pnpm run release
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
"devDependencies": {
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.1",
"@semantic-release/release-notes-generator": "^14.0.2",
"@types/node": "^22.10.1",
"changelogen": "^0.5.7",
"dotenv-cli": "^7.4.4",
Expand Down
Loading

0 comments on commit aa9112d

Please sign in to comment.