Skip to content

Commit

Permalink
chore: github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Dec 11, 2023
1 parent eb84a9f commit f9f97a5
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Docker Image Build and Publish

on:
push:
tags:
- 'v*.*.*'
# branches:
# - 'master'

concurrency:
cancel-in-progress: true
group: docker-images-${{ github.ref_name }}

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ${{ inputs.context || '.' }}
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
35 changes: 35 additions & 0 deletions .github/workflows/release-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Manual Release

on:
workflow_dispatch:

concurrency:
cancel-in-progress: true
group: release-${{ github.ref_name }}

jobs:
yarn-release:
runs-on: ubuntu-latest
name: Create release using standard-version
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}

- name: Install dependencies
run: yarn --immutable

- name: Run release
env:
GIT_AUTHOR_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GIT_AUTHOR_NAME: "github-actions[bot]"
run: yarn release

- name: Push release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url --push origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git push -f --follow-tags origin master
37 changes: 37 additions & 0 deletions .github/workflows/release-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Merge Release

on:
pull_request:
types: [closed]

concurrency:
cancel-in-progress: true
group: release-${{ github.ref_name }}

jobs:
yarn-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
name: Create release using standard-version
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}

- name: Install dependencies
run: yarn --immutable

- name: Run release
env:
GIT_AUTHOR_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GIT_AUTHOR_NAME: "github-actions[bot]"
run: yarn release

- name: Push release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url --push origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git push -f --follow-tags origin master

0 comments on commit f9f97a5

Please sign in to comment.