From c6477803ed5e7b3e797159633721013fec0eedf6 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Tue, 17 Sep 2024 09:20:52 +0200 Subject: [PATCH] Fix .github/workflows/release.yml (#13831) --- .github/workflows/release.yml | 65 +++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7e1795d3b4..c0f078de6b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,16 +43,19 @@ jobs: if: github.ref_type == 'branch' run: | ref_name=${{ github.ref_name }}-latest + + if ! gh release view $ref_name; then + gh release create \ + --latest=false \ + --title $ref_name \ + --notes "Automated release for latest ${{ github.ref_name }}." \ + $ref_name + fi + git tag $ref_name --force git push origin $ref_name --force - gh release create \ - $ref_name \ - —-latest=false \ - --title $ref_name \ - --notes "Automated release for latest ${{ github.ref_name }}." \ - || true - release_pre_built: + build: needs: create_draft_release strategy: fail-fast: true @@ -70,16 +73,19 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 50 + - uses: ./.github/workflows/release_pre_built with: otp_version: ${{ matrix.otp_version }} otp: ${{ matrix.otp }} build_docs: ${{ matrix.build_docs }} + - uses: actions/attest-build-provenance@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: subject-path: 'elixir-otp-${{ matrix.otp }}.*' + - uses: actions/attest-build-provenance@v1 if: ${{ matrix.build_docs }} env: @@ -87,6 +93,29 @@ jobs: with: subject-path: 'Docs.*' + - uses: actions/upload-artifact@v4 + with: + name: elixir-otp-${{ matrix.otp }} + path: elixir-otp-${{ matrix.otp }}* + + - uses: actions/upload-artifact@v4 + if: ${{ matrix.build_docs }} + with: + name: Docs + path: Docs.zip* + + upload: + needs: build + runs-on: windows-2022 + + steps: + - uses: actions/download-artifact@v4 + + - run: | + mv elixir-otp-*/* . + mv Docs/* . + shell: bash + - name: "Sign files with Trusted Signing" if: github.repository == 'elixir-lang/elixir' uses: azure/trusted-signing-action@v0.4.0 @@ -104,6 +133,7 @@ jobs: timestamp-digest: SHA256 - name: Upload Pre-built + shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -113,14 +143,13 @@ jobs: tag="${{ github.ref_name }}" fi - gh release upload --clobber "$tag" \ - elixir-otp-${{ matrix.otp }}.zip \ - elixir-otp-${{ matrix.otp }}.zip.sha{1,256}sum \ - elixir-otp-${{ matrix.otp }}.exe \ - elixir-otp-${{ matrix.otp }}.exe.sha{1,256}sum - - if [ "${{ matrix.build_docs }}" == "build_docs" ]; then - gh release upload --clobber "$tag" \ - Docs.zip \ - Docs.zip.sha{1,256}sum - fi + gh release upload \ + --repo ${{ github.repository }} \ + --clobber \ + "$tag" \ + elixir-otp-*.zip \ + elixir-otp-*.zip.sha{1,256}sum \ + elixir-otp-*.exe \ + elixir-otp-*.exe.sha{1,256}sum \ + Docs.zip \ + Docs.zip.sha{1,256}sum