Merge branch 'io-1104' into test #319
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
name: Oslo Designsystem QA and deploy | |
on: | |
push: | |
branches: | |
- test | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: test | |
env: | |
URL: 'Oslo Designsystem Devtools' | |
ENVIRONMENT: test | |
SLACK_CHANNEL: C044EMZ22JX | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Slack status | |
id: slack | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
channel-id: ${{ env.SLACK_CHANNEL }} | |
payload: | | |
{ | |
"text": "Continuous deployment", | |
"attachments": [ | |
{ | |
"color": "${{ env.MESSAGE_COLOR }}", | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }}", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Repository*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Branch*\n${{ github.ref_name }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Status*\n${{ env.MESSAGE_STATUS }}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Environment*\n${{ env.ENVIRONMENT }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Target*\n${{ env.URL }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
MESSAGE_COLOR: '#f9c66b' | |
MESSAGE_STATUS: 'AUDIT AND LINTING IN PROGRESS' | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Audit and lint | |
id: qa | |
run: | | |
npm install | |
npm audit --audit-level high | |
npm run eslint | |
npm run stylelint | |
- name: Update Slack status | |
if: success() | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
update-ts: ${{ steps.slack.outputs.ts }} | |
channel-id: ${{ env.SLACK_CHANNEL }} | |
payload: | | |
{ | |
"text": "Continuous deployment", | |
"attachments": [ | |
{ | |
"color": "${{ env.MESSAGE_COLOR }}", | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }}", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Repository*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Branch*\n${{ github.ref_name }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Status*\n${{ env.MESSAGE_STATUS }}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Environment*\n${{ env.ENVIRONMENT }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Target*\n${{ env.URL }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
MESSAGE_COLOR: '#f9c66b' | |
MESSAGE_STATUS: 'HANDOVER TO DEVTOOLS IN PROGRESS' | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Call workflow | |
if: success() | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/oslokommune/ukeweb_designsystem_devtools/actions/workflows/aws_test.yml/dispatches \ | |
-d '{ "ref": "test" }' | |
- name: Update Slack status | |
if: success() | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
update-ts: ${{ steps.slack.outputs.ts }} | |
channel-id: ${{ env.SLACK_CHANNEL }} | |
payload: | | |
{ | |
"text": "Continuous deployment", | |
"attachments": [ | |
{ | |
"color": "${{ env.MESSAGE_COLOR }}", | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }}", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Repository*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Branch*\n${{ github.ref_name }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Status*\n${{ env.MESSAGE_STATUS }}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Environment*\n${{ env.ENVIRONMENT }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Target*\n${{ env.URL }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
MESSAGE_COLOR: '#43f8b6' | |
MESSAGE_STATUS: 'SUCCESS' | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Update Slack status | |
if: failure() | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
update-ts: ${{ steps.slack.outputs.ts }} | |
channel-id: ${{ env.SLACK_CHANNEL }} | |
payload: | | |
{ | |
"text": "Continuous deployment", | |
"attachments": [ | |
{ | |
"color": "${{ env.MESSAGE_COLOR }}", | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }}", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Repository*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Branch*\n${{ github.ref_name }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Status*\n${{ env.MESSAGE_STATUS }}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Environment*\n${{ env.ENVIRONMENT }}" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Target*\n${{ env.URL }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
MESSAGE_COLOR: '#ff8274' | |
MESSAGE_STATUS: 'FAILED' | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |