Skip to content

Commit

Permalink
ci: OK
Browse files Browse the repository at this point in the history
  • Loading branch information
staticaland committed Aug 3, 2022
1 parent 532a331 commit ef65de5
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 78 deletions.
76 changes: 75 additions & 1 deletion .github/workflows/goreleaser.cue
Original file line number Diff line number Diff line change
@@ -1 +1,75 @@
{}
package workflows

import "encoding/json"

SlackBlockRelease: {
"blocks": [
{
"type": "section"
"text": {
"type": "mrkdwn"
"text": "A new version of `whaturl` has been released: `${{ github.event.release.tag_name }}` :tada:"
}
"accessory": {
"type": "button"
"text": {
"type": "plain_text"
"text": "See details"
}
"url": "${{ github.event.release.html_url }}"
}
},
]
}

goreleaser: {

name: "GoReleaser"

on: push: tags: [
"*",
]

permissions: contents: "write"

jobs: {

goreleaser: {
"runs-on": "ubuntu-latest"
steps: [{
name: "Checkout"
uses: "actions/checkout@v2"
with: "fetch-depth": 0
}, {
name: "Fetch all tags"
run: "git fetch --force --tags"
}, {
name: "Set up Go"
uses: "actions/setup-go@v2"
with: "go-version": 1.18
}, {
name: "Run GoReleaser"
uses: "goreleaser/goreleaser-action@v3"
with: {
distribution: "goreleaser"
version: "latest"
args: "release --rm-dist"
}
env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
}]
}

notify: {
name: "Perform Slack notification"
"runs-on": "ubuntu-latest"
steps: [
#SlackAction & {
with: {
payload: json.Marshal(SlackBlockRelease)
}
},
]
}

}
}
30 changes: 15 additions & 15 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
---
name: GoReleaser

on:
"on":
push:
tags:
- '*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Fetch all tags
- name: Fetch all tags
run: git fetch --force --tags
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify:
name: Perform Slack notification
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@v1.21.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: workflows
payload: '{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":"A new version of `whaturl` has been released: `${{ github.event.release.tag_name }}` :tada:"},"accessory":{"type":"button","text":{"type":"plain_text","text":"See details"},"url":"${{ github.event.release.html_url }}"}}]}'
46 changes: 0 additions & 46 deletions .github/workflows/release_notify.cue

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/release_notify.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/vale.cue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import "encoding/json"
#SlackAction: {
uses: string | *"slackapi/slack-github-action@v1.21.0"
env: SLACK_BOT_TOKEN: string | *"${{ secrets.SLACK_BOT_TOKEN }}"
with: {
"channel-id": "workflows"
...
}
...
}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: slackapi/slack-github-action@v1.21.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: workflows
payload: '{"text":"Deployment started (In Progress)","attachments":[{"pretext":"Deployment started","color":"dbab09","fields":[{"title":"Status","short":true,"value":"In Progress","run_link":"https://${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}]}]}'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
fail_on_error: true
reporter: github-check
- uses: slackapi/slack-github-action@v1.21.0
if: ${{ failure() }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
if: ${{ failure() }}
with:
channel-id: workflows
payload: '{"text":"Vale deployment failure","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"*Vale* deployment :warning: failure :warning:"}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"Vale DocOps failed deployment during. Write better! The best way to fix this particular issue is \u003chttps://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|viewing the CI server logs\u003e to learn why and fix the issue."}}]}'
5 changes: 5 additions & 0 deletions .github/workflows/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ workflows: [
filename: "vale.yml"
workflow: vale
},
{
filename: "goreleaser.yml"
workflow: goreleaser
},

]

0 comments on commit ef65de5

Please sign in to comment.