diff --git a/.github/workflows/create_version_tag.yml b/.github/workflows/create_version_tag.yml index acee1ebbd8..70f6ffdbef 100644 --- a/.github/workflows/create_version_tag.yml +++ b/.github/workflows/create_version_tag.yml @@ -29,6 +29,8 @@ on: jobs: monthly_release: runs-on: ubuntu-latest + outputs: + version_name: ${{ steps.set_version_name.outputs.version_name }} steps: #checkout main branch - name: Checkout code @@ -63,15 +65,20 @@ jobs: fi # Create version name accessible in the following steps - name: Set version name + id: set_version_name run: | - echo "VERSION_NAME=v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-$(date +'%Y.%m.%d')" >> $GITHUB_ENV + # Use format vMAJOR.MINOR.PATCH-YY.MM e.g., v1.2.3-24.06 for June 2024 + VERSION_NAME="v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-$(date +'%y.%m')" + echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV + echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT echo "VERSION_NAME=$VERSION_NAME" - # Create a new version tag - - name: Create version tag - run: | - git config user.email "t8ddy.bot@gmail.com" - git config user.name "t8ddy" - # configure remote to use the secret token for pushing - git remote set-url origin https://x-access-token:${{ secrets.T8DDY_TOKEN }}@github.com/${{ github.repository }} - git tag "${{ env.VERSION_NAME }}" - git push origin --tags \ No newline at end of file + + t8code_tarball: + uses: ./.github/workflows/test_tarball.yml + needs: monthly_release + secrets: inherit + with: + TEST_LEVEL: 'T8_TEST_LEVEL_BASIC' + RELEASE_VERSION: ${{ needs.monthly_release.outputs.version_name }} + UPLOAD_TO_RELEASE: true + diff --git a/.github/workflows/test_tarball.yml b/.github/workflows/test_tarball.yml index 2c465a9cb4..fd2782cec0 100644 --- a/.github/workflows/test_tarball.yml +++ b/.github/workflows/test_tarball.yml @@ -37,10 +37,18 @@ on: type: string description: 'Test level used for configuring (T8_TEST_LEVEL_FULL, T8_TEST_LEVEL_MEDIUM, or T8_TEST_LEVEL_BASIC)' default: 'T8_TEST_LEVEL_FULL' + RELEASE_VERSION: + required: false + type: string + description: 'Create a release with this version (e.g., v1.2.3-24.06) and upload the tarball to it' + UPLOAD_TO_RELEASE: + required: false + type: boolean + description: 'Whether to upload the tarball to the release' + default: false jobs: build_tarball: - if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule') runs-on: ubuntu-latest container: dlramr/t8code-ubuntu:t8-dependencies @@ -139,5 +147,21 @@ jobs: with: name: build_tar.log path: build_tar/test-suite.log + - name: retrieve name of tarball + run: | + TAR_NAME=$(basename tarballs/*.tar.gz) + echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV + - name: upload as release asset + if: ${{ inputs.UPLOAD_TO_RELEASE == true }} + uses: ncipollo/release-action@v1 + with: + name: ${{ inputs.RELEASE_VERSION }} + commit: main + tag: ${{ inputs.RELEASE_VERSION }} + artifacts: "tarballs/*.tar.gz" + body: "Automated release of t8code version ${{ inputs.RELEASE_VERSION }} created from tarball tested in CI." + generate_release_notes: true + token: ${{ secrets.T8DDY_TOKEN }} +