Skip to content

Commit

Permalink
Refacto - update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rhannachi committed Jul 25, 2023
1 parent 04944ee commit 6b8a3d6
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ jobs:

extract-version:
needs: [ test ]
name: "Extract version (package.json)"
name: "Extract package version"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/mainFALSE'
environment:
name: Production
outputs:
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:
needs: [ extract-version ]
name: "Create Tag"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/mainFALSE'
environment:
name: Production
steps:
Expand All @@ -300,16 +300,16 @@ jobs:
echo "Tag already present: ${{ steps.create-tag.outputs.tag_exists }}"
release:
needs: [ create-tag ]
needs: [ test ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: Production
steps:
- uses: actions/checkout@v3

- name: Prepare repository
run: git fetch --unshallow --tags
# - name: Prepare repository
# run: git fetch --unshallow --tags

- uses: pnpm/action-setup@v2
with:
Expand All @@ -326,12 +326,39 @@ jobs:
with:
name: my_node_modules_artifact

- name: unzip node_modules
- name: Unzip node_modules
run: tar -xzf node_modules.tar.gz

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
###
- name: Get package version
id: get-version
run: |
pnpm release
version=v$(pnpm pkg get version | tr -d '"')
echo "version=$version" >> $GITHUB_OUTPUT
echo "====> $version"
shell: bash

- uses: rickstaa/action-create-tag@v1
id: create-tag
with:
tag: ${{ steps.get-version.outputs.version }}
tag_exists_error: false
message: ${{ steps.get-version.outputs.version }}
- run: |
echo "Tag already present: ${{ steps.create-tag.outputs.tag_exists }}"
###

- name: Extract release notes from CHANGELOG.md
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
with:
changelog_file: CHANGELOG.md

- name: "Create a GitHub release v${{ steps.get-version.outputs.version }}"
uses: ncipollo/release-action@v1
with:
tag: "v${{ steps.get-version.outputs.version }}"
name: "Release v${{ steps.get-version.outputs.version }}"
body: |
## Release notes:
${{ steps.extract-release-notes.outputs.release_notes }}

0 comments on commit 6b8a3d6

Please sign in to comment.