Skip to content

Commit

Permalink
[gh action] Release on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jul 20, 2019
1 parent 3b4a86a commit fb910e0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:stable-slim

LABEL "name"="filter"
LABEL "version"="1.1.0"
LABEL "name"="commit-matches-branch"
LABEL "version"="1.0.0"

LABEL "com.github.actions.name"="Filter commit message"
LABEL "com.github.actions.description"="Stop a workflow if the message of the current commit doesn't match the pattern"
LABEL "com.github.actions.name"="Commit matches branch"
LABEL "com.github.actions.description"="Only continue the workflow if the current commit is the last commit of the given branch"
LABEL "com.github.actions.icon"="filter"
LABEL "com.github.actions.color"="gray-dark"

Expand Down
13 changes: 13 additions & 0 deletions .github/actions/commit-matches-branch/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -e

current=$(git rev-parse HEAD)
git checkout $1
branch=$(git rev-parse HEAD)

if [ "$current" = "$branch" ]; then
exit 0
else
exit 78
fi
16 changes: 0 additions & 16 deletions .github/actions/create-release-tag/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions .github/actions/create-release-tag/entrypoint.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/actions/filter-commit-message/entrypoint.sh

This file was deleted.

20 changes: 13 additions & 7 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
workflow "Release" {
resolves = [
"Trigger GitHub release",
"Is version tag",
]
on = "release"
on = "push"
resolves = ["Trigger GitHub release"]
}

action "Is version tag" {
uses = "actions/bin/filter@master"
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24"
args = "tag v*"
}

action "Is tag from master" {
uses = "./commit-matches-branch/"
needs = [
"Is version tag",
]
args = "master"
}

action "Trigger GitHub release" {
uses = "./.github/actions/trigger-github-release/"
uses = "./trigger-github-release/"
secrets = ["GITHUB_TOKEN"]
env = {
COMMIT_AUTHOR_NAME = "Babel Bot"
COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com"
}
needs = [
"Is version tag",
"Is tag from master",
]
}

Expand Down

0 comments on commit fb910e0

Please sign in to comment.