mirror of
https://github.com/LukeHagar/theschemagen.git
synced 2025-12-06 04:21:44 +00:00
adding action
This commit is contained in:
118
.github/workflows/release.yaml
vendored
Normal file
118
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
GO_VERSION: 1.21.3
|
||||
APP_NAME: theschemagen
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Verify Dependencies
|
||||
run: go mod verify
|
||||
|
||||
- name: Lint ${{ env.APP_NAME }}
|
||||
run: go vet ./...
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Verify Dependencies
|
||||
run: go mod verify
|
||||
|
||||
- name: Test ${{ env.APP_NAME }}
|
||||
run: go test -v ./...
|
||||
|
||||
changelog:
|
||||
name: Changelog
|
||||
needs:
|
||||
- lint
|
||||
- test
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
skipped: ${{ steps.changelog.outputs.skipped }}
|
||||
tag: ${{ steps.changelog.outputs.tag }}
|
||||
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }}
|
||||
version: ${{ steps.changelog.outputs.version }}
|
||||
|
||||
env:
|
||||
PR_BRANCH: release-ci-${{ github.sha }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
- name: Create Branch
|
||||
run: |
|
||||
git checkout -b ${{ env.PR_BRANCH }}
|
||||
|
||||
- name: Create Changelog
|
||||
uses: TriPSs/conventional-changelog-action@dd734f74fce61a6e02f821ee1b5930bc79a23534 # v5
|
||||
id: changelog
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
git-user-name: "github-actions[bot]"
|
||||
git-user-email: "github-actions[bot]@users.noreply.github.com"
|
||||
git-branch: ${{ env.PR_BRANCH }}
|
||||
skip-git-pull: true
|
||||
output-file: false
|
||||
version-file: .github/package.yaml
|
||||
create-summary: true
|
||||
|
||||
- name: Create Changelog PR
|
||||
if: steps.changelog.outputs.skipped == 'false'
|
||||
run: |
|
||||
gh pr create --base main --head ${{ env.PR_BRANCH }} --title 'chore(release): ${{ steps.changelog.outputs.tag }} [skip-ci]' --body '${{ steps.changelog.outputs.clean_changelog }}'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Approve Changelog PR
|
||||
if: steps.changelog.outputs.skipped == 'false'
|
||||
run: |
|
||||
gh pr review --approve ${{ env.PR_BRANCH }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }}
|
||||
|
||||
- name: Merge Changelog PR
|
||||
if: steps.changelog.outputs.skipped == 'false'
|
||||
run: |
|
||||
gh pr merge --squash --auto --delete-branch ${{ env.PR_BRANCH }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }}
|
||||
Reference in New Issue
Block a user