F/bump vocdoni sdk 0.5.0 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 01-JS-Release | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
paths: | ||
- 'packages/js-client/**' | ||
- '.github/workflows/js-client-*.yml' | ||
jobs: | ||
test: | ||
uses: ./.github/workflows/javascript_test.yml | ||
Check failure on line 13 in .github/workflows/js-client-release.yml GitHub Actions / .github/workflows/js-client-release.ymlInvalid workflow file
|
||
secrets: | ||
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} | ||
prepare: | ||
name: Prepare release generation | ||
needs: ['test'] | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged | ||
outputs: | ||
PACKAGE_LIST: ${{ steps.matrix.outputs.pkg_list }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'develop' | ||
- name: Setup Python environment | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- name: Get package-list from label-list | ||
id: matrix | ||
run: | | ||
PKG_LIST=$(python ./.github/scripts/js-client-generate-release-matrix.py) | ||
PR_LABEL_LIST="${{ toJson(github.event.pull_request.labels.*.name) }}" | ||
echo "Pkg list: $PKG_LIST" | ||
echo "Label list: $PR_LABEL_LIST" | ||
echo "pkg_list=$PKG_LIST" >> $GITHUB_OUTPUT | ||
env: | ||
PULL_LABELS: ${{ toJson(github.event.pull_request.labels) }} | ||
release: | ||
name: Set Github Tag | ||
runs-on: ubuntu-latest | ||
needs: [prepare] | ||
## This condition gets TRUE if used in this way: ${{ contains(toJson(xyz), 'substr') }} | ||
if: ${{ contains( toJson(github.event.pull_request.labels.*.name), '-release' ) }} | ||
strategy: | ||
fail-fast: true | ||
matrix: ${{ fromJson(needs.prepare.outputs.PACKAGE_LIST) }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'develop' | ||
- name: Get version from '${{ matrix.package }}' package.json | ||
id: getver | ||
working-directory: './packages/${{ matrix.package }}' | ||
run: | | ||
VERSION=$(cat package.json | jq -r .version) | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
echo "Version: $VERSION" | ||
- name: Set Github Tag via API | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.ARABOT_PAT_TRIGGER_WORKFLOW }} | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: `refs/tags/${{ steps.getver.outputs.version }}-javascript-${{ matrix.package }}`, | ||
sha: "${{ github.sha }}" | ||
}) |