Skip to content

Commit

Permalink
Update workflow to handle published releases
Browse files Browse the repository at this point in the history
The GitHub Actions workflow has been updated to support both prereleased and published events. The logic to define the package version has been revised to differentiate between preview and published versions. Additionally, publishing to npmjs.com and nuget.org is now only conducted when a release is published.
  • Loading branch information
sfmskywalker committed Dec 31, 2023
1 parent d777ea6 commit 0c2ef80
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:
branches:
- main
release:
types: [ prereleased ]
types: [ prereleased, published ]
env:
package_version: 3.0.0-preview.${{ github.run_number }}
nuget_feed_feedzio: 'https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json'
nuget_feed_nuget: 'https://api.nuget.org/v3/index.json'
npm_feed_feedzio: 'https://f.feedz.io/elsa-workflows/elsa-3/npm/'
Expand All @@ -26,7 +25,14 @@ jobs:
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set VERSION variable
run: echo "VERSION=${{env.package_version}}" >> $GITHUB_ENV
run: |
if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then
TAG_NAME=${{ github.ref }} # e.g., refs/tags/3.0.0
TAG_NAME=${TAG_NAME#refs/tags/} # remove the refs/tags/ prefix
echo "VERSION=${TAG_NAME}" >> $GITHUB_ENV
else
echo "VERSION=3.0.0-preview.${{github.run_number}}" >> $GITHUB_ENV
fi
- name: Build workflow designer client assets
working-directory: ./src/modules/Elsa.Studio.Workflows.Designer/ClientLib
run: |
Expand Down Expand Up @@ -109,12 +115,12 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.FEEDZ_API_KEY_BASE64}}
publish_npm_preview_npm:
publish_npm_npm:
name: Publish npm packages to npmjs.com
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
steps:
- name: Download Packages
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -151,12 +157,12 @@ jobs:
- name: Publish to feedz.io
run: dotnet nuget push ./elsa-studio-nuget-packages/*.nupkg -k ${{ secrets.FEEDZ_API_KEY }} -s ${{ env.nuget_feed_feedzio }} --skip-duplicate

publish_nuget_preview_nuget:
publish_nuget_nuget:
name: Publish to nuget.org
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
steps:
- name: Download Packages
uses: actions/download-artifact@v3
Expand Down

0 comments on commit 0c2ef80

Please sign in to comment.