Skip to content

Commit

Permalink
WIP: dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr committed Oct 30, 2023
1 parent 744b92c commit 6ab1c1b
Showing 1 changed file with 78 additions and 78 deletions.
156 changes: 78 additions & 78 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,70 +86,70 @@ jobs:
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@v4
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@v4
# 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
Expand All @@ -161,17 +161,17 @@ jobs:
run: |
git push origin -d ${{ needs.prepare.outputs.nightly_branch }}
notify_failed:
runs-on: ubuntu-latest
if: always() && contains(needs.*.result, 'failure')
needs: [ cleanup, upload, release, check, prepare ]
steps:
- name: Notifying about Nightly fail!
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_FAILURE_WEBHOOK_URL }}
with:
payload: |
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
# notify_failed:
# runs-on: ubuntu-latest
# if: always() && contains(needs.*.result, 'failure')
# needs: [ cleanup, upload, release, check, prepare ]
# steps:
# - name: Notifying about Nightly fail!
# uses: slackapi/[email protected]
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_FAILURE_WEBHOOK_URL }}
# with:
# payload: |
# {
# "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# }

0 comments on commit 6ab1c1b

Please sign in to comment.