Skip to content

Commit

Permalink
Update nightly.yml
Browse files Browse the repository at this point in the history
Signed-off-by: MrDenkoV <[email protected]>
  • Loading branch information
MrDenkoV authored Sep 20, 2023
1 parent 9ee00a4 commit 4983409
Showing 1 changed file with 89 additions and 65 deletions.
154 changes: 89 additions & 65 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,84 +73,108 @@ jobs:
ref: ${{ needs.prepare.outputs.nightly_branch }}
fail-fast: false

notify_failed_checks:
name: notifying about nightly tests fail!
uses: slackapi/[email protected]
needs: [check]
if: always() && needs.check.result == 'failure'
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_FAILURE_WEBHOOK_URL }}
payload: |
{
"url": ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
}
release:
uses: ./.github/workflows/_build-release.yml
needs: prepare
with:
scarb-tag: v${{ needs.prepare.outputs.nightly_version }}
ref: ${{ needs.prepare.outputs.nightly_branch }}

upload:
runs-on: ubuntu-latest
needs: [ prepare, release ]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.prepare.outputs.nightly_branch }}

- name: Create source code archives
run: |
git archive "--prefix=scarb-${{ needs.prepare.outputs.nightly_tag }}/" -o "scarb-${{ needs.prepare.outputs.nightly_tag }}.zip" HEAD
git archive "--prefix=scarb-${{ needs.prepare.outputs.nightly_tag }}/" -o "scarb-${{ needs.prepare.outputs.nightly_tag }}.tar.gz" HEAD
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts-dl

- name: Unpack artifacts to staging directory
run: |
mkdir -p artifacts
mv artifacts-dl/build-*/scarb-* artifacts/
mv artifacts-dl/checksums/* artifacts/
ls -lh artifacts/
- name: Create GitHub release
run: |
gh release create \
"${{ needs.prepare.outputs.nightly_tag }}" \
--repo software-mansion/scarb-nightlies \
--latest \
--title "${{ needs.prepare.outputs.nightly_tag }}" \
--notes-file NIGHTLY_RELEASE_NOTES.md
env:
GH_TOKEN: ${{ secrets.SCARB_NIGHTLIES_CONTENTS_WRITE }}

- name: Upload release assets
run: |
for file in \
./artifacts/* \
"scarb-${{ needs.prepare.outputs.nightly_tag }}.zip#Scarb source code (zip)" \
"scarb-${{ needs.prepare.outputs.nightly_tag }}.tar.gz#Scarb source code (tar.gz)"
do
# If there isn't # in name, it means that it is a build artifact
# and we need to remove version tag from the name, so it can be
# easily accessed in asdf and Scarb installation scripts
#
# for example:
# scarb-v0.6.0+nightly-2023-08-09-aarch64-apple-darwin.tar.gz
# becomes
# scarb-nightly-2023-08-09-aarch64-apple-darwin.tar.gz
if ! [[ $(grep "#" <<< $file) ]]; then
label=$(echo $file | sed -E "s/v[^+]*\+//" | sed -E "s/.\/artifacts\///")
cp "$file" "$label"
file="$label"
fi
gh release upload \
"${{ needs.prepare.outputs.nightly_tag }}" \
"$file" \
--repo software-mansion/scarb-nightlies
done
env:
GH_TOKEN: ${{ secrets.SCARB_NIGHTLIES_CONTENTS_WRITE }}
# upload:
# runs-on: ubuntu-latest
# needs: [ prepare, release ]
# steps:
# - uses: actions/checkout@v3
# with:
# ref: ${{ needs.prepare.outputs.nightly_branch }}

# - name: Create source code archives
# run: |
# git archive "--prefix=scarb-${{ needs.prepare.outputs.nightly_tag }}/" -o "scarb-${{ needs.prepare.outputs.nightly_tag }}.zip" HEAD
# git archive "--prefix=scarb-${{ needs.prepare.outputs.nightly_tag }}/" -o "scarb-${{ needs.prepare.outputs.nightly_tag }}.tar.gz" HEAD

# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# path: artifacts-dl

# - name: Unpack artifacts to staging directory
# run: |
# mkdir -p artifacts
# mv artifacts-dl/build-*/scarb-* artifacts/
# mv artifacts-dl/checksums/* artifacts/
# ls -lh artifacts/

# - name: Create GitHub release
# run: |
# gh release create \
# "${{ needs.prepare.outputs.nightly_tag }}" \
# --repo software-mansion/scarb-nightlies \
# --latest \
# --title "${{ needs.prepare.outputs.nightly_tag }}" \
# --notes-file NIGHTLY_RELEASE_NOTES.md
# env:
# GH_TOKEN: ${{ secrets.SCARB_NIGHTLIES_CONTENTS_WRITE }}

# - name: Upload release assets
# run: |
# for file in \
# ./artifacts/* \
# "scarb-${{ needs.prepare.outputs.nightly_tag }}.zip#Scarb source code (zip)" \
# "scarb-${{ needs.prepare.outputs.nightly_tag }}.tar.gz#Scarb source code (tar.gz)"
# do
# # If there isn't # in name, it means that it is a build artifact
# # and we need to remove version tag from the name, so it can be
# # easily accessed in asdf and Scarb installation scripts
# #
# # for example:
# # scarb-v0.6.0+nightly-2023-08-09-aarch64-apple-darwin.tar.gz
# # becomes
# # scarb-nightly-2023-08-09-aarch64-apple-darwin.tar.gz
# if ! [[ $(grep "#" <<< $file) ]]; then
# label=$(echo $file | sed -E "s/v[^+]*\+//" | sed -E "s/.\/artifacts\///")
# cp "$file" "$label"
# file="$label"
# fi

# gh release upload \
# "${{ needs.prepare.outputs.nightly_tag }}" \
# "$file" \
# --repo software-mansion/scarb-nightlies
# done
# env:
# GH_TOKEN: ${{ secrets.SCARB_NIGHTLIES_CONTENTS_WRITE }}

cleanup:
runs-on: ubuntu-latest
if: always() && needs.prepare.result == 'success'
needs: [ prepare, upload ]
needs: [ prepare]#, upload ]
steps:
- uses: actions/checkout@v3
- name: Delete nightly branch
run: |
git push origin -d ${{ needs.prepare.outputs.nightly_branch }}
notify_failed:
name: Notifying about nightly fail!
uses: slackapi/[email protected]
needs: [cleanup]
if: always() && needs.cleanup.result == 'failure'
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_FAILURE_WEBHOOK_URL }}
payload: |
{
"url": ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
}

0 comments on commit 4983409

Please sign in to comment.