Skip to content

Commit

Permalink
♻️ci: add release.yml (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marukome0743 authored Oct 22, 2024
1 parent acd69d1 commit d9ed2e3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ on:
- "Dockerfile"
- "package.json"
- "*config.*"
release:
types:
- published
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
no-cache:
Expand All @@ -52,7 +51,7 @@ env:
GHCR_REGISTRY: ghcr.io
GHCR_REPOSITORY: openup-labtakizawa/dcrs
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
IS_PUSH: ${{ github.event_name == 'push' || github.ref_type == 'tag' || inputs.push == true }}
IS_PUSH: ${{ github.event_name == 'push' || inputs.push == true }}

jobs:
build:
Expand Down Expand Up @@ -95,7 +94,9 @@ jobs:
name=${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REPOSITORY }},enable=${{ fromJSON(env.IS_PUSH) }}
labels: org.opencontainers.image.revision=${{ env.SHA }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=ref,event=pr,prefix=pr-
type=raw,value=canary,enable=${{ github.event_name != 'pull_request_target' }}
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ permissions:

env:
AWS_REGION: ap-northeast-1
ECR_REPOSITORY: dcrs
LAMBDA_FUNCTION_NAME: dcrs
ECR_REPOSITORY: ${{ github.event.repository.name }}
LAMBDA_FUNCTION_NAME: ${{ github.event.repository.name }}

jobs:
lambda:
Expand Down
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:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
type: string

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
if: github.repository_owner == 'openup-labtakizawa'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check if the tag has already been released
run: |
if [[ $(git tag -l $VERSION) ]]; then
echo TAG_EXISTS=true >> $GITHUB_ENV
fi
- name: Create release
if: env.TAG_EXISTS != 'true'
run: gh release create $VERSION --generate-notes -t "$REPO_NAME $VERSION"
env:
GH_TOKEN: ${{ github.token }}
REPO_NAME: ${{ github.event.repository.name }}
VERSION: ${{ github.event.inputs.version || github.ref_name }}

0 comments on commit d9ed2e3

Please sign in to comment.