-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
228 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Code quality CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
shellcheck: | ||
name: runner / shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: haya14busa/action-cond@v1 | ||
id: reporter | ||
with: | ||
cond: ${{ github.event_name == 'pull_request' }} | ||
if_true: "github-pr-review" | ||
if_false: "github-check" | ||
- uses: reviewdog/action-shellcheck@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: ${{ steps.reporter.outputs.value }} | ||
level: warning | ||
hadolint: | ||
name: runner / hadolint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: haya14busa/action-cond@v1 | ||
id: reporter | ||
with: | ||
cond: ${{ github.event_name == 'pull_request' }} | ||
if_true: "github-pr-review" | ||
if_false: "github-check" | ||
- uses: reviewdog/action-hadolint@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: ${{ steps.reporter.outputs.value }} | ||
level: warning | ||
misspell: | ||
name: runner / misspell | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: reviewdog/action-misspell@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-check | ||
level: warning | ||
locale: "US" |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Docker Image CI | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag rickstaa-action-create-tag:$(date +%s) |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
types: | ||
- labeled | ||
jobs: | ||
release: | ||
if: github.event.action != 'labeled' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Bump version on merging Pull Requests with specific labels. | ||
# (bump:major,bump:minor,bump:patch) | ||
- id: bumpr | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
uses: haya14busa/action-bumpr@v1 | ||
# Update corresponding major and minor tag. | ||
# e.g. Update v1 and v1.2 when releasing v1.2.3 | ||
- uses: haya14busa/action-update-semver@v1 | ||
if: "!steps.bumpr.outputs.skip" | ||
with: | ||
tag: ${{ steps.bumpr.outputs.next_version }} | ||
# Get tag name. | ||
- id: tag | ||
uses: haya14busa/action-cond@v1 | ||
with: | ||
cond: "${{ startsWith(github.ref, 'refs/tags/') }}" | ||
if_true: ${{ github.ref }} | ||
if_false: ${{ steps.bumpr.outputs.next_version }} | ||
# Create release. | ||
- uses: actions/create-release@v1 | ||
if: "steps.tag.outputs.value != ''" | ||
env: | ||
# This token is provided by Actions, you do not need to create your own token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag.outputs.value }} | ||
release_name: Release ${{ steps.tag.outputs.value }} | ||
body: ${{ steps.bumpr.outputs.message }} | ||
draft: false | ||
prerelease: false | ||
release-check: | ||
if: github.event.action == 'labeled' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Post bumpr status comment | ||
uses: haya14busa/action-bumpr@v1 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# IDE | ||
.vsode/ | ||
*.code-workspace |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "bashdb", | ||
"request": "launch", | ||
"name": "Bash-Debug (simplest configuration)", | ||
"program": "${file}", | ||
"env": { | ||
"INPUT_TAG": "v1.0.2" | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:3.10 | ||
|
||
RUN apk --no-cache add git && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 haya14busa | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Create tag." | ||
description: "Creates tags on a tag push." | ||
author: "Rick Staa" | ||
inputs: | ||
github_token: | ||
description: "GITHUB_TOKEN. Optional if you use checkout@v2 action." | ||
default: "${{ github.token }}" | ||
tag: | ||
description: "Optional. Existing tag to update from. Default comes from $GITHUB_REF." | ||
required: false | ||
message: | ||
description: "Tag message." | ||
required: false | ||
commit_sha: | ||
description: The commit SHA hash on which you want to push the tag. Uses latest commit by default. | ||
required: false | ||
force_push_tag: | ||
description: "Optional. Force push the tag. Defaults to 'false'." | ||
required: false | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
branding: | ||
icon: "tag" | ||
color: "blue" |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
cd "${GITHUB_WORKSPACE}" || exit | ||
|
||
if [ -z "${INPUT_TAG}" ]; then | ||
echo "No-tag was supplied! Please supply a tag." | ||
exit 1 | ||
fi | ||
|
||
# Set up variables. | ||
TAG="${INPUT_TAG}" | ||
MESSAGE="${INPUT_MESSAGE:-Release ${TAG}}" | ||
FORCE_TAG="${INPUT_FORCE_PUSH_TAG:-false}" | ||
|
||
# Set up Git credentials | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
|
||
# Update MAJOR/MINOR tag | ||
if [ "${INPUT_FORCE_PUSH_TAG}" == 'true' ]; then | ||
git tag -fa "${TAG}" -m "${MESSAGE}" | ||
else | ||
git tag -a "${TAG}" -m "${MESSAGE}" | ||
fi | ||
|
||
# Set up remote url for checkout@v1 action. | ||
if [ -n "${INPUT_GITHUB_TOKEN}" ]; then | ||
git remote set-url origin "https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
fi | ||
|
||
# Push tag | ||
if [ "${INPUT_FORCE_PUSH_TAG}" == 'true' ]; then | ||
git push --force origin "${TAG}" | ||
else | ||
git push origin "${TAG}" | ||
fi |