diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 4f03151..39a612b 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -3,7 +3,7 @@ name: Build Release on: push: tags: - - "v*.*.*" + - "*.*.*" jobs: @@ -39,9 +39,6 @@ jobs: # Checkout Local Repository - name: Checkout uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - with: - persist-credentials: false - ref: ${{ github.ref }} # Get the Package version based on the package.json file - name: Get Version diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..7eef110 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,67 @@ +name: Bump Version + +on: + workflow_dispatch: + inputs: + version: + description: 'Version number' + required: true + +jobs: + + # Validate Repository Configuration + config: + runs-on: ubuntu-latest + outputs: + config_package: ${{ steps.config_package.outputs.configPackage }} + steps: + + # Ensure that required repository variable has been created for the Package + - name: Validate Package Config + id: config_package + run: | + if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then + echo "configPackage=true" >> $GITHUB_OUTPUT; + else + echo "configPackage=false" >> $GITHUB_OUTPUT; + fi + + # Build and release the Package + # If the repository is not configured properly, this job will be skipped + build: + needs: config + runs-on: ubuntu-latest + permissions: + contents: write + #pull-requests: write + env: + packagePath: Packages/${{ vars.PACKAGE_NAME }} + if: needs.config.outputs.config_package == 'true' + steps: + + - name: Checkout + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 + #token: ${{ secrets.TOKEN }} + + - name: Update package.json + uses: jossef/action-set-json-field@890d7642122dbb2833dddd2003659bb71a2b21fe + with: + file: ${{ env.packagePath }}/package.json + field: version + value: ${{ github.event.inputs.version }} + + - name: Commit changes + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -am "Bump version to ${{ github.event.inputs.version }}" + git tag -a ${{ github.event.inputs.version }} -m "Version ${{ github.event.inputs.version }}" + + - name: Push changes + uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa + with: + github_token: ${{ secrets.TOKEN }} + tags: true \ No newline at end of file