diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml index 57b752ef..2ad7c04d 100644 --- a/.github/workflows/bump_version.yml +++ b/.github/workflows/bump_version.yml @@ -12,7 +12,8 @@ on: jobs: bump-up-version: if: github.event.pull_request.merged == true - secrets: inherit + secrets: + SECRET: ${{secrets.VERSION_DECOIMPACT}} uses: ./.github/workflows/version_upgrade.yml with: release_type: patch diff --git a/.github/workflows/mkdocs_documentation.yml b/.github/workflows/mkdocs_documentation.yml index 40e7adb8..e2cd690c 100644 --- a/.github/workflows/mkdocs_documentation.yml +++ b/.github/workflows/mkdocs_documentation.yml @@ -10,6 +10,11 @@ on: jobs: create-docs: runs-on: ubuntu-latest + env: + if: ${{ lower(inputs.project_version) == upper(inputs.project_version) }} + env: + VERSION: ${{ inputs.project_version }} + steps: - name: checkout code uses: actions/checkout@v4 @@ -30,5 +35,5 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - poetry run mike deploy --push --update-aliases ${{ inputs.project_version }} latest - poetry run mike set-default --push latest \ No newline at end of file + poetry run mike deploy --push --update-aliases "$VERSION" latest + poetry run mike set-default --push latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9d6e58c..3dbebe7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,8 @@ on: jobs: bump-up-version: - secrets: inherit + secrets: + SECRET: ${{secrets.VERSION_DECOIMPACT}} uses: ./.github/workflows/version_upgrade.yml with: release_type: ${{ github.event.inputs.release_type }} @@ -37,7 +38,8 @@ jobs: create-documentation: needs: bump-up-version - secrets: inherit + secrets: + SECRET: ${{secrets.VERSION_DECOIMPACT}} uses: ./.github/workflows/mkdocs_documentation.yml with: project_version: ${{ needs.bump-up-version.outputs.project_version }} @@ -45,5 +47,7 @@ jobs: docker-build: needs: bump-up-version uses: ./.github/workflows/docker_image.yml + secrets: + SECRET: ${{ secrets.GITHUB_TOKEN }} with: project_version: ${{ needs.bump-up-version.outputs.project_version }} diff --git a/.github/workflows/version_upgrade.yml b/.github/workflows/version_upgrade.yml index 4778e3a2..e33a0983 100644 --- a/.github/workflows/version_upgrade.yml +++ b/.github/workflows/version_upgrade.yml @@ -9,6 +9,7 @@ on: inputs: release_type: required: true + description: Choose type of release type: string outputs: project_version: @@ -18,6 +19,9 @@ on: jobs: upgrade-version: runs-on: ubuntu-latest + env: + # check if the input is valid, if not set it to empty string, if valid it will be used in the poetry version command + RELEASE_TYPE: ${{ (inputs.release_type == 'major' || inputs.release_type == 'minor' || inputs.release_type == 'patch') && inputs.release_type || '' }} outputs: job_output_version: ${{ steps.get-version.outputs.PROJECT_VERSION}} steps: @@ -39,7 +43,7 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - poetry version ${{ inputs.release_type }} + poetry version "$RELEASE_TYPE" PROJECT_VERSION=$(poetry version --short) echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_OUTPUT sed -i "1 s/.*/version: $PROJECT_VERSION/" template_input.yaml @@ -48,5 +52,5 @@ jobs: PROJECT_VERSION=$(poetry version --short) git add template_input.yaml git add pyproject.toml - git commit -m "bump ${{ inputs.release_type }} version: ${{ steps.get-version.outputs.PROJECT_VERSION }}" + git commit -m "bump "$RELEASE_TYPE" version: ${{ steps.get-version.outputs.PROJECT_VERSION }}" git push \ No newline at end of file