tango command: use attribute_query() to check if attribute exists
#469
This file contains hidden or 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: Create/Update Tag | |
| "on": | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| create-version-tag: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.CI_TOKEN }} | |
| - name: Set up Conda environment with Micromamba | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| cache-environment: true | |
| create-args: >- | |
| python=3.10 | |
| environment-file: conda-environment-dev.yml | |
| post-cleanup: all | |
| - name: Update version | |
| id: update-version | |
| run: | | |
| ${MAMBA_EXE} run --name mxcubecore poetry version minor | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Marcus Oskarsson" | |
| git add -A | |
| git commit -m "[skip ci] Bumped minor version" | |
| git push -f | |
| ${MAMBA_EXE} run --name mxcubecore poetry build | |
| - name: Publish package to PyPI | |
| id: publish-pacakge | |
| # yamllint disable rule:line-length | |
| run: | | |
| ${MAMBA_EXE} run --name mxcubecore poetry config pypi-token.pypi ${{ secrets.PYPI }} | |
| ${MAMBA_EXE} run --name mxcubecore poetry publish | |
| # yamllint enable rule:line-length | |
| - name: Read package version | |
| id: set-tag | |
| # yamllint disable rule:line-length | |
| run: | | |
| pip install --upgrade pip | |
| pip install toml | |
| echo "tag_name=v$(${MAMBA_EXE} run --name mxcubecore poetry version -s)" >> $GITHUB_ENV | |
| # yamllint enable rule:line-length | |
| - name: Check tag exists | |
| id: check-tag-exists | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| // https://github.com/mukunku/tag-exists-action | |
| var exists = 'false'; | |
| try { | |
| const getRefResponse = await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/${{ env.tag_name }}" | |
| }); | |
| if (getRefResponse.status === 200) { | |
| console.log("Tag was found"); | |
| exists = 'true'; | |
| } | |
| } catch(error) { | |
| console.log("Tag was not found"); | |
| } | |
| core.setOutput('exists', exists); | |
| - name: Update tag | |
| uses: actions/github-script@v6 | |
| if: steps.check-tag-exists.outputs.exists == 'true' | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.updateRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/${{ env.tag_name }}", | |
| sha: context.sha | |
| }) | |
| - name: Create tag | |
| uses: actions/github-script@v6 | |
| if: steps.check-tag-exists.outputs.exists != 'true' | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/${{ env.tag_name }}", | |
| sha: context.sha | |
| }) |