Skip to content

Commit

Permalink
ci: reuse workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
escalate committed Jan 13, 2024
1 parent b508fa8 commit b192a39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 375 deletions.
50 changes: 2 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,13 @@ name: Release
'on':
workflow_run:
workflows:
- Tests
- Test
branches:
- master
types:
- completed
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for Go files
id: check_go
uses: andstor/file-existence-action@v2
with:
files: "**/*.go"

- name: Fetch all tags
if: steps.check_go.outputs.files_exists == 'true'
run: git fetch --force --tags

- name: Set up Go
if: steps.check_go.outputs.files_exists == 'true'
uses: actions/setup-go@v5
with:
go-version: 'stable'

- name: Install GoReleaser
if: steps.check_go.outputs.files_exists == 'true'
uses: goreleaser/goreleaser-action@v5
with:
install-only: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Install semantic-release
run: |
npm install -g semantic-release conventional-changelog-conventionalcommits
- name: Create Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${{ steps.check_go.outputs.files_exists }}" == "true" ]]; then
npx -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/git semantic-release
else
npx semantic-release
fi
uses: escalate/github-actions-workflows/.github/workflows/release.yml@master
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Test
'on':
push:
branches:
- master
pull_request:
jobs:
test:
name: Test
uses: escalate/github-actions-workflows/.github/workflows/test.yml@master
Loading

0 comments on commit b192a39

Please sign in to comment.