diff --git a/.github/workflows/cicd-1-pull-request.yaml b/.github/workflows/cicd-1-pull-request.yaml index fce0f0e..a969f9c 100644 --- a/.github/workflows/cicd-1-pull-request.yaml +++ b/.github/workflows/cicd-1-pull-request.yaml @@ -25,6 +25,7 @@ jobs: python_version: ${{ steps.variables.outputs.python_version }} terraform_version: ${{ steps.variables.outputs.terraform_version }} version: ${{ steps.variables.outputs.version }} + is_version_prerelease: ${{ steps.pr_exists.outputs.is_version_prerelease }} does_pull_request_exist: ${{ steps.pr_exists.outputs.does_pull_request_exist }} steps: - name: "Checkout code" @@ -42,6 +43,8 @@ jobs: echo "python_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "terraform_version=$(grep "^terraform" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT + echo "is_version_prerelease=$(if [[ $a == *-* ]] then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT + - name: "Check if pull request exists for this branch" id: pr_exists env: @@ -98,7 +101,7 @@ jobs: name: "Build stage" needs: [metadata, test-stage] uses: ./.github/workflows/stage-3-build.yaml - if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event.action == 'push' && github.ref == 'refs/heads/main') + if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main') with: build_datetime: "${{ needs.metadata.outputs.build_datetime }}" build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}" @@ -112,7 +115,7 @@ jobs: name: "Acceptance stage" needs: [metadata, build-stage] uses: ./.github/workflows/stage-4-acceptance.yaml - if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event.action == 'push' && github.ref == 'refs/heads/main') + if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main') with: build_datetime: "${{ needs.metadata.outputs.build_datetime }}" build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}" @@ -135,4 +138,5 @@ jobs: python_version: "${{ needs.metadata.outputs.python_version }}" terraform_version: "${{ needs.metadata.outputs.terraform_version }}" version: "${{ needs.metadata.outputs.version }}" + is_version_prerelease: "${{ needs.metadata.outputs.is_version_prerelease }}" secrets: inherit diff --git a/.github/workflows/stage-5-publish.yaml b/.github/workflows/stage-5-publish.yaml index c8fa389..da126b2 100644 --- a/.github/workflows/stage-5-publish.yaml +++ b/.github/workflows/stage-5-publish.yaml @@ -31,7 +31,10 @@ on: description: "Version of the software, set by the CI/CD pipeline workflow" required: true type: string - + is_version_prerelease: + description: "Is this a semantically versioned pre release, set by the CI/CD pipeline workflow" + required: true + type: string jobs: publish: name: "Publish packages" @@ -57,7 +60,7 @@ jobs: body: | Release of ${{ inputs.version }} draft: false - prerelease: false + prerelease: ${{ inputs.is_version_prerelease }} - name: "Upload jeykll docs release asset" uses: actions/upload-release-asset@v1 env: @@ -67,7 +70,16 @@ jobs: asset_path: ./artifacts asset_name: jekyll-docs-${{ inputs.version }}.tar.gz asset_content_type: "application/gzip" - # - name: "Upload release asset" + # - name: "Upload other release asset 1" + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: "${{ steps.create_release.outputs.upload_url }}" + # asset_path: ./* + # asset_name: repository-template-${{ inputs.version }}.tar.gz + # asset_content_type: "application/gzip" + # - name: "Upload other release asset 2" # uses: actions/upload-release-asset@v1 # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}