From 0f7af6fbded3632b4def7b22eb6e6161632c4599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 18 Apr 2024 15:06:44 +0200 Subject: [PATCH] WIP --- .github/workflows/release-upload.yaml | 46 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release-upload.yaml b/.github/workflows/release-upload.yaml index 4b602c7251..63470160a8 100644 --- a/.github/workflows/release-upload.yaml +++ b/.github/workflows/release-upload.yaml @@ -25,9 +25,11 @@ env: GH_TOKEN: ${{ github.token }} jobs: - wait-for-hydra: - name: "Wait for hydra check-runs" + wait_for_hydra: runs-on: ubuntu-latest + outputs: + TARGET_TAG: ${{ steps.check_target_tag.TARGET_TAG }} + FLAKE_REF: ${{ steps.define_flake_ref.FLAKE_REF }} steps: - name: Define target tag (1/2) if: ${{ inputs.target_tag != '' }} # If a tag was specified manually as input, use it @@ -43,17 +45,22 @@ jobs: echo "TARGET_TAG=$current_tag" >> "$GITHUB_ENV" fi - name: Check tag is defined - if: ${{ env.TARGET_TAG == '' }} + id: check_target_tag run: | - echo "The tag to build binaries for is undefined! Either:" - echo "- This pipeline should run on a commit that has a tag" - echo "- This pipeline should be executed manually and the tag to target should be specified with the 'target_tag' input" - exit 1 + if [[ "${{ env.TARGET_TAG }}" == "" ]] + then + echo "The tag to build binaries for is undefined! Either:" + echo "- This pipeline should run on a commit that has a tag" + echo "- This pipeline should be executed manually and the tag to target should be specified with the 'target_tag' input" + exit 1 + fi + echo "TARGET_TAG=${{ env.TARGET_TAG }}" >> "$GITHUB_OUTPUT" - name: Define FLAKE_REF + id: define_flake_ref run: | flake_ref="github:${{ github.repository }}/${{ env.TARGET_TAG }}" - echo "$flake_ref" echo "FLAKE_REF=$flake_ref" >> "$GITHUB_ENV" + echo "FLAKE_REF=$flake_ref" >> "$GITHUB_OUTPUT" - name: Get specific check run status timeout-minutes: 120 run: | @@ -74,7 +81,7 @@ jobs: done pull: - needs: [wait-for-hydra] + needs: [wait_for_hydra] strategy: matrix: arch: [linux] @@ -93,18 +100,19 @@ jobs: - name: LS run: | ls - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: LS - run: | - ls + # - name: LS + # run: | + # ls - name: Display flake metadata id: flake-metadata run: | - nix flake metadata ${{ env.FLAKE_REF }} - nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_ENV" + nix --version + nix flake metadata "${{ needs.wait_for_hydra.outputs.FLAKE_REF }}" + nix flake metadata "${{ needs.wait_for_hydra.outputs.FLAKE_REF }}" --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_ENV" - name: Build run: | case ${{ matrix.arch }} in @@ -132,7 +140,7 @@ jobs: retention-days: 1 upload-assets: - needs: [pull] + needs: [wait_for_hydra, pull] name: "Upload Assets" runs-on: ubuntu-latest steps: @@ -150,7 +158,7 @@ jobs: uses: input-output-hk/action-gh-release@v1 with: draft: true - tag_name: ${{ env.TARGET_TAG }} + tag_name: ${{ needs.wait_for_hydra.outputs.TARGET_TAG }} files: | # TODO generalize # cardano-cli-*-win64.zip