From cfabedc4e9b476f37aa5779d828cb211b0289b3f Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sun, 19 Mar 2023 15:37:33 -0700 Subject: [PATCH] Add pre-dev publishing to Actions workflows --- .github/workflows/appimage.yml | 32 +++++++++++++++++++++++++ .github/workflows/windows.yml | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index cc0d16b8f..8fd7608f9 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -10,6 +10,8 @@ on: branches: - dev workflow_dispatch: +env: + publish_pre_dev_labels: '[]' jobs: build: runs-on: ubuntu-18.04 @@ -167,3 +169,33 @@ jobs: files: | ${{env.PUBLISH_NAME}}.AppImage ${{env.PUBLISH_NAME}}-AboutThisBuild.txt + + - name: Prepare for publishing pre-dev + id: prepare-publish-pre-dev + if: ${{github.event_name == 'pull_request' && contains(fromJSON(env.publish_pre_dev_labels), github.event.pull_request.head.label)}} + run: | + echo "Making ref name." + REF_NAME_FILTERED="$(echo '${{github.event.pull_request.head.label}}' | tr ':' '_' | sed 's/[^A-z0-9_.-]//g')" + echo "Ref name is '$REF_NAME_FILTERED'." + + echo "Setting publish name." + PUBLISH_NAME="RawTherapee_${REF_NAME_FILTERED}_${{matrix.build_type}}" + echo "Publish name is '$PUBLISH_NAME'." + + echo "Renaming AppImage." + cp "build/$ARTIFACT_NAME.AppImage" "$PUBLISH_NAME.AppImage" + + echo "Creating version file." + cp "build/AboutThisBuild.txt" "$PUBLISH_NAME-AppImage-AboutThisBuild.txt" + + echo "Recording publish name." + echo "PUBLISH_NAME=$PUBLISH_NAME" >> $GITHUB_ENV + + - name: Publish pre-dev artifacts + uses: softprops/action-gh-release@v1 + if: ${{steps.prepare-publish-pre-dev.outcome == 'success'}} + with: + tag_name: pre-dev-github-actions + files: | + ${{env.PUBLISH_NAME}}.AppImage + ${{env.PUBLISH_NAME}}-AppImage-AboutThisBuild.txt diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 49fdf5999..a14c23993 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,6 +10,8 @@ on: branches: - dev workflow_dispatch: +env: + publish_pre_dev_labels: '[]' jobs: build: runs-on: windows-2022 @@ -300,3 +302,44 @@ jobs: with: tag_name: nightly-github-actions files: build/${{env.PUBLISH_NAME}}.exe + + - name: Prepare for publishing pre-dev + id: prepare-publish-pre-dev + if: ${{github.event_name == 'pull_request' && contains(fromJSON(env.publish_pre_dev_labels), github.event.pull_request.head.label)}} + run: | + echo "Making ref name." + REF_NAME_FILTERED="$(echo '${{github.event.pull_request.head.label}}' | tr ':' '_' | sed 's/[^A-z0-9_.-]//g')" + echo "Ref name is '$REF_NAME_FILTERED'." + + echo "Setting publish name." + PUBLISH_NAME="RawTherapee_${REF_NAME_FILTERED}_win64_${{matrix.build_type}}" + echo "Publish name is '$PUBLISH_NAME'." + if [ "$ARTIFACT_NAME" != "$PUBLISH_NAME" ]; then + echo "Renaming ZIP file." + cp "build/$ARTIFACT_NAME.zip" "build/$PUBLISH_NAME.zip" + if [ -e "./build/$ARTIFACT_NAME.exe" ]; then + echo "Renaming installer." + mv "./build/$ARTIFACT_NAME.exe" "./build/$PUBLISH_NAME.exe" + fi + fi + echo "Creating version file." + cp "build/$ARTIFACT_NAME/AboutThisBuild.txt" "build/$PUBLISH_NAME-AboutThisBuild.txt" + + echo "Recording publish name." + echo "PUBLISH_NAME=$PUBLISH_NAME" >> "$(cygpath -u $GITHUB_ENV)" + + - name: Publish pre-dev artifacts + uses: softprops/action-gh-release@v1 + if: ${{steps.prepare-publish-pre-dev.outcome == 'success'}} + with: + tag_name: pre-dev-github-actions + files: | + build/${{env.PUBLISH_NAME}}.zip + build/${{env.PUBLISH_NAME}}-AboutThisBuild.txt + + - name: Publish pre-dev installer + uses: softprops/action-gh-release@v1 + if: ${{steps.prepare-publish-pre-dev.outcome == 'success' && matrix.build_type == 'release'}} + with: + tag_name: pre-dev-github-actions + files: build/${{env.PUBLISH_NAME}}.exe