Skip to content

Commit

Permalink
feat: add publish tag workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdevpereira committed Oct 28, 2022
1 parent 815cf6c commit 5009350
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
release:
types: [published, edited]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Build Action
run: npm ci && npm run build

- uses: JasonEtco/build-and-tag-action@v2
env:
GITHUB_TOKEN: ${{ github.token }}
28 changes: 1 addition & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
branches:
- main
- development

name: Release
jobs:
Expand Down Expand Up @@ -32,29 +32,3 @@ jobs:
default-branch: main
pull-request-title-pattern: "🚀 Release ${component} ${version}"
changelog-types: '[{"type":"feat","section":"✨ Features","hidden":false},{"type":"fix","section":"🚨 Bug Fixes","hidden":false},{"type":"hotfix","section":"🚒 Hotfixes","hidden":false},{"type":"chore","section":"👷 Maintenance","hidden":false},{"type":"docs","section":"📚 Documentation","hidden":false}]'

- uses: actions/checkout@v3

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
cache-dependency-path: "./pnpm-lock.yaml"

- name: tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name carlosdevpereira
git config user.email carlos@carlosdevpereira.com
pnpm install && pnpm build
git add dist/** -f
git commit -m "chore: rebuild action"
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin v${{ steps.release.outputs.major }} -f
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -f

1 comment on commit 5009350

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{"coverage":{"summary":{"statements":{"total":218,"covered":208,"skipped":0,"percentage":95.41},"lines":{"total":210,"covered":206,"skipped":0,"percentage":98.09},"functions":{"total":32,"covered":32,"skipped":0,"percentage":100},"branches":{"total":46,"covered":32,"skipped":0,"percentage":69.56}},"percentage":90,"badges":{"coverage":"https://img.shields.io/badge/Coverage-90﹪-brightgreen","tests":"https://img.shields.io/badge/Tests-%E2%9C%94%2042%20%7C%20%E2%9C%98%200%20%7C%20%E2%8C%80%200-brightgreen"},"report":{"url":"https://5009350.test-publish-to-cloudflare.pages.dev"}},"stats":{"startTime":1666962101514,"endTime":1666962103936,"testSuites":{"total":9,"passed":9,"failed":0},"tests":{"total":42,"passed":42,"failed":0},"snapshots":{"total":0}}}

Please sign in to comment.