-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christian Zunker <[email protected]>
- Loading branch information
Showing
1 changed file
with
120 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,29 +7,143 @@ on: | |
description: "Version to test" | ||
required: true | ||
default: "9.0.0" | ||
release: | ||
types: [published] | ||
|
||
env: | ||
# C07QZDJFF89 == #release-coordination | ||
SLACK_BOT_CHANNEL_ID: "C07QZDJFF89" | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
name: 'Unify Inputs' | ||
outputs: | ||
version: ${{ steps.version.outputs.version }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set Version (Workflow Dispatch) | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV | ||
- name: Set Version (Release Event) | ||
if: github.event_name == 'release' | ||
run: | | ||
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV | ||
- name: Unified Version | ||
id: version | ||
run: | | ||
INPUT_NAME=${{ inputs.name }} | ||
if [[ ${INPUT_NAME} == '' ]]; then | ||
echo "Name is empty, using default" | ||
echo "name=mondoo" >> $GITHUB_OUTPUT | ||
else | ||
echo "Name: ${INPUT_NAME}" | ||
echo "name=${INPUT_NAME}" >> $GITHUB_OUTPUT | ||
fi | ||
V=$(echo $VERSION | sed 's/v//') | ||
echo "Version: $V" | ||
echo "version=${V}" >> $GITHUB_OUTPUT | ||
# wait at least for one package to be published, otherwise tests will fail directly | ||
- name: Wait for packages to be published (Release Event) | ||
if: github.event_name == 'release' | ||
id: check_release_file | ||
uses: nick-fields/retry@v3 | ||
with: | ||
retry_wait_seconds: 10 | ||
timeout_seconds: 5 | ||
max_attempts: 60 | ||
retry_on: error | ||
# error on HTTP code different to 200 | ||
command: | | ||
vSEMVER=${{ steps.version.outputs.version }} | ||
SEMVER="${vSEMVER//v}" | ||
curl -o /dev/null -s -w "%{http_code}\n" "https://releases.mondoo.com/mondoo/${SEMVER}/mondoo_${SEMVER}_windows_amd64.msi" | grep 200 | ||
notification-start: | ||
needs: setup | ||
name: start notification | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
outputs: | ||
update-ts: ${{ steps.slack.outputs.ts }} | ||
steps: | ||
- id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
payload: | | ||
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}" | ||
text: "GitHub Actions Run" | ||
attachments: | ||
- color: "#FFFF00" | ||
blocks: | ||
- type: "section" | ||
fields: | ||
- type: "mrkdwn" | ||
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>" | ||
- type: "mrkdwn" | ||
text: "*Status:*\n`In Progress`" | ||
test-arch: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-archlinux.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
test-docker: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-docker.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
test-install-sh: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-install-sh.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
test-install-ps1: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-install-ps1.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
test-osx-pkg: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-osx-pkg.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
test-brew: | ||
needs: setup | ||
uses: ./.github/workflows/test-released-brew.yaml | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
version: ${{ needs.setup.outputs.version }} | ||
|
||
notification: | ||
runs-on: ubuntu-latest | ||
name: Send Slack notification | ||
needs: [test-arch, test-docker, test-install-sh, test-install-ps1, test-osx-pkg, test-brew] | ||
if: ${{ always() }} | ||
steps: | ||
- name: Set status | ||
id: status | ||
run: | | ||
echo "status_success=${{ needs.test-arch.result == 'success' && needs.test-docker.result == 'success' && needs.test-install-sh.result == 'success' && needs.test-install-ps1.result == 'success' && needs.test-osx-pkg.result == 'success' && needs.test-brew.result == 'success' }}" >> $GITHUB_OUTPUT | ||
- uses: slackapi/[email protected] | ||
if : ${{ always() }} | ||
with: | ||
method: chat.update | ||
token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
payload: | | ||
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}" | ||
ts: "${{ needs.notification-start.outputs.update-ts }}" | ||
color: "${{ needs.status.status_success == 'true' && '#00FF00' || '#FF0000' }}" | ||
text: "GitHub Actions Run" | ||
attachments: | ||
- blocks: | ||
- type: "section" | ||
fields: | ||
- type: "mrkdwn" | ||
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>" | ||
- type: "mrkdwn" | ||
text: "*Status:*\n`${{ needs.status.status_success == 'true' && 'Success' || 'Failed' }}`" |