From 1ba1486e8dd733b4ca50241b7a5e990c91d10d55 Mon Sep 17 00:00:00 2001 From: teutoburg Date: Mon, 9 Sep 2024 00:06:24 +0200 Subject: [PATCH 1/4] Call bump workflow in devops to avoid copies This is especially useful if versions need to be updated, which currently has to be done in every repo manually for bump and publish workflows... --- .github/workflows/bump.yml | 55 +++++--------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 3fb466d..b22b748 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -43,52 +43,9 @@ on: jobs: bump: name: Bump version number - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - bumpmsg: ${{ steps.bumping.outputs.BUMP_MSG }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Set up Poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: "1.7.1" - - - name: Bump package Version using Poetry - id: bumping - env: - RULE: ${{ inputs.rule }} - DRY: ${{ inputs.dry-run && '--dry-run' || '' }} - run: echo "BUMP_MSG=$(poetry version $DRY $RULE)" >> $GITHUB_OUTPUT - - - name: Output debug msg - if: inputs.dry-run - env: - BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }} - run: | - echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY - echo "Dry run only, no actual modification made." >> $GITHUB_STEP_SUMMARY - - - name: Commit changes - # could also use https://github.com/stefanzweifel/git-auto-commit-action instead - if: ${{ ! inputs.dry-run }} - env: - BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }} - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -am "$BUMP_MSG" - git push - echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY - echo "Successfully committed and pushed version bump." >> $GITHUB_STEP_SUMMARY + uses: AstarVienna/DevOps/.github/workflows/bump.yml@main + secrets: inherit + with: + dry-run: ${{ inputs.dry-run }} + rule: ${{ inputs.rule }} + branch: ${{ inputs.branch }} From ec4762f31f54576a8ce8e3eb3999249daa0d193d Mon Sep 17 00:00:00 2001 From: teutoburg Date: Mon, 9 Sep 2024 00:10:41 +0200 Subject: [PATCH 2/4] Remove now-redundant workflow_call If it needs to be called, just call the one in DevOps directly. This rump workflow now only exists to allow manual bumping easily. --- .github/workflows/bump.yml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index b22b748..c0f1cc8 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -20,32 +20,10 @@ on: - prerelease - "prerelease --next-phase" - workflow_call: - inputs: - dry-run: - type: boolean - description: Only output new version number, no actual change. - required: false - rule: - type: string - description: Version bump level - required: true - branch: - type: string - description: Branch (ref) to checkout and push changes to - required: false - default: ${{ github.ref_name }} - outputs: - bumpmsg: - description: Message created by the version bump. - value: ${{ jobs.bump.outputs.bumpmsg }} - jobs: bump: - name: Bump version number uses: AstarVienna/DevOps/.github/workflows/bump.yml@main secrets: inherit with: dry-run: ${{ inputs.dry-run }} rule: ${{ inputs.rule }} - branch: ${{ inputs.branch }} From 571221cf2878cbd18d33a55a41e1e4fc45d7a8e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:14:14 +0000 Subject: [PATCH 3/4] Bumping version from 0.41.0a0 to 0.41.0a1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9c6193d..3b29f19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "speXtra" -version = "0.41.0a0" +version = "0.41.0a1" description = "Tool to manage and manipulate astronomical spectra." license = "MIT" authors = ["Miguel Verdugo "] From f5ebe5dc94278ff22be4cb8c0782fa08a568f7a5 Mon Sep 17 00:00:00 2001 From: teutoburg Date: Mon, 9 Sep 2024 00:15:07 +0200 Subject: [PATCH 4/4] Use DevOps bump also in publish workflow --- .github/workflows/bump.yml | 2 +- .github/workflows/publish_pypi.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index c0f1cc8..3ba4f9f 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -21,7 +21,7 @@ on: - "prerelease --next-phase" jobs: - bump: + Bump: uses: AstarVienna/DevOps/.github/workflows/bump.yml@main secrets: inherit with: diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 046f536..a69c4a3 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -5,7 +5,7 @@ on: - published jobs: - build: + Build: name: Build package using Poetry runs-on: ubuntu-latest steps: @@ -44,7 +44,7 @@ jobs: if: ${{ success() }} run: echo "### Successfully built package" >> $GITHUB_STEP_SUMMARY - publish: + Publish: name: Publish package to PyPI runs-on: ubuntu-latest needs: build @@ -77,11 +77,11 @@ jobs: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} run: poetry publish >> $GITHUB_STEP_SUMMARY - bump: + Bump: name: Bump to (next) dev version needs: publish if: ${{ needs.publish.result == 'success' }} - uses: ./.github/workflows/bump.yml + uses: AstarVienna/DevOps/.github/workflows/bump.yml@main secrets: inherit with: rule: prerelease