Unverified Commit 078a641e authored by Claire Labry's avatar Claire Labry
Browse files

prepare for draft PR

parent 75144f8c
Branches unavailable nightly
No related merge requests found
Showing with 80 additions and 78 deletions
+80 -78
......@@ -7,7 +7,8 @@
name: Nightly Release
on:
push:
# TODO: remove the push event before merging this PR; this is for testing purposes
# push:
schedule:
# Runs against the default branch every day at midnight
- cron: "0 0 * * *"
......@@ -16,6 +17,7 @@ on:
jobs:
# Build a fresh set of artifacts
build-artifacts:
# TODO: change branch from add-nightlies to main before merging this PR
uses: hashicorp/nomad/.github/workflows/build.yml@add-nightlies
github-release:
needs: build-artifacts
......@@ -28,83 +30,83 @@ jobs:
path: out/
# Set BUILD_OUTPUT_LIST to out\<project>-<version>.<fileext>\*,out\...
# This is needed to attach the build artifacts to the GitHub Release
# - name: Set BUILD_OUTPUT_LIST
# run: |
# echo "$(ls -xm1 out/)" > tmp.txt
# cat tmp.txt | sed 's:.*:out/&/*:' > tmp2.txt
# echo "BUILD_OUTPUT_LIST=$(cat tmp2.txt | tr '\n' ',' | perl -ple 'chop')" >> $GITHUB_ENV
# rm -rf tmp.txt && rm -rf tmp2.txt
# - name: Advance nightly tag
# uses: actions/github-script@v3
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# try {
# await github.git.deleteRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: "tags/nightly"
# })
# } catch (e) {
# console.log("Warning: The nightly tag doesn't exist yet, so there's nothing to do. Trace: " + e)
# }
# await github.git.createRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: "refs/tags/nightly",
# sha: context.sha
# })
- name: Set BUILD_OUTPUT_LIST
run: |
echo "$(ls -xm1 out/)" > tmp.txt
cat tmp.txt | sed 's:.*:out/&/*:' > tmp2.txt
echo "BUILD_OUTPUT_LIST=$(cat tmp2.txt | tr '\n' ',' | perl -ple 'chop')" >> $GITHUB_ENV
rm -rf tmp.txt && rm -rf tmp2.txt
- name: Advance nightly tag
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/nightly"
})
} catch (e) {
console.log("Warning: The nightly tag doesn't exist yet, so there's nothing to do. Trace: " + e)
}
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/nightly",
sha: context.sha
})
# This will create a new GitHub Release called `nightly`
# If a release with this name already exists, it will overwrite the existing data
# - name: Create a nightly GitHub prerelease
# id: create_prerelease
# uses: ncipollo/release-action@v1
# with:
# name: nightly
# artifacts: "${{ env.BUILD_OUTPUT_LIST }}"
# tag: nightly
# bodyFile: ".github/workflows/nightly-release-readme.md"
# prerelease: true
# allowUpdates: true
# removeArtifacts: true
# draft: false
# token: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish nightly GitHub prerelease
# uses: eregon/publish-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# release_id: ${{ steps.create_prerelease.outputs.id }}
- name: Create a nightly GitHub prerelease
id: create_prerelease
uses: ncipollo/release-action@v1
with:
name: nightly
artifacts: "${{ env.BUILD_OUTPUT_LIST }}"
tag: nightly
bodyFile: ".github/workflows/nightly-release-readme.md"
prerelease: true
allowUpdates: true
removeArtifacts: true
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish nightly GitHub prerelease
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_prerelease.outputs.id }}
# # Send a slack notification if either job defined above fails
# slack-notify:
# needs:
# - build-artifacts
# - github-release
# if: always() && (needs.build-artifacts.result == 'failure' || needs.github-release.result == 'failure')
# runs-on: ubuntu-latest
# steps:
# - name: Send slack notification on failure
# uses: slackapi/slack-github-action@v1.18.0
# with:
# payload: |
# {
# "text": ":alert: Nomad Nightly Release *FAILED* :alert:",
# "attachments": [
# {
# "color": "#C41E3A",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "Branch: `${{ github.ref_name }}`\nRef: ${{ github.sha }}\nWorkflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# }
# }
# ]
# }
# ]
# }
# env:
# # the slack webhook url links to #feed-nomad-releases
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
slack-notify:
needs:
- build-artifacts
- github-release
if: always() && (needs.build-artifacts.result == 'failure' || needs.github-release.result == 'failure')
runs-on: ubuntu-latest
steps:
- name: Send slack notification on failure
uses: slackapi/slack-github-action@v1.18.0
with:
payload: |
{
"text": ":alert: Nomad Nightly Release *FAILED* :alert:",
"attachments": [
{
"color": "#C41E3A",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Branch: `${{ github.ref_name }}`\nRef: ${{ github.sha }}\nWorkflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
]
}
env:
# the slack webhook url links to #feed-nomad-releases
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment