-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
8 changed files
with
203 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,13 @@ | ||
name: Docker Image CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(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,63 @@ | ||
name: release | ||
on: | ||
push: | ||
# Use push on master event to run workflow instead of pull_request | ||
# closed (merged) event because github token doesn't have write permission | ||
# for pull_request from fork repository. | ||
branches: | ||
- master | ||
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/')" | ||
name: haya14busa/action-bumpr | ||
uses: ./ | ||
|
||
# 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: | ||
github_token: ${{ secrets.github_token }} | ||
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 | ||
# Post bumpr status comment | ||
- name: haya14busa/action-bumpr | ||
uses: ./ |
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,14 @@ | ||
name: Action test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test action | ||
uses: ./ | ||
id: Test |
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 @@ | ||
# Files to ignore | ||
*.code-workspace | ||
|
||
# Folders to ignore | ||
.vscode/ |
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,12 @@ | ||
FROM alpine:3.10 | ||
|
||
ENV BUMP_VERSION=v1.1.0 | ||
|
||
SHELL ["/bin/ash", "-eo", "pipefail", "-c"] | ||
|
||
RUN apk --no-cache add git jq grep curl | ||
RUN wget -O - -q | sh -s -- -b /usr/local/bin/ ${BUMP_VERSION} | ||
|
||
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 |
---|---|---|
@@ -1 +1,52 @@ | ||
# action-get-semver | ||
|
||
A simple action that returns the current/next major, minor, and patch version based on the given semver | ||
version. | ||
|
||
[](https://github.com/riokstaa/action-get-semver/actions?query=workflow%3ATest) | ||
[](https://github.com/rickstaa/action-get-semver/actions?query=workflow%3Arelease) | ||
[](https://github.com/rickstaa/action-get-semver/releases) | ||
|
||
## Input | ||
|
||
```yaml | ||
inputs: | ||
bump_level: | ||
description: "Version bump level [major,minor,patch]." | ||
required: False | ||
default: "patch" | ||
outputs: | ||
current_version: | ||
description: "The current version." | ||
next_version: | ||
description: "The next major version." | ||
``` | ||
## Usage | ||
```yaml | ||
name: release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: rickstaa/action-get-semver@v1 | ||
with: | ||
|
||
- name: Print semver | ||
id: get_semver | ||
with: | ||
bump_level: "minor" | ||
run: | | ||
echo "Current version: ${{ steps.get_semver.outputs.current_version }}" | ||
echo "Next version: ${{ steps.get_semver.outputs.next_version }}" | ||
``` | ||
### Acknowledgement | ||
This action serves as a wrapper around the [bump](https://github.com/haya14busa/bump) package of [@haya14busa](https://github.com/haya14busa/bump/commits?author=haya14busa). |
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,20 @@ | ||
name: "Get Semver" | ||
description: "Get current/next major, minor, and patch version based on the given semver version." | ||
author: "Rick Staa" | ||
inputs: | ||
bump_level: | ||
description: "Version bump level [major,minor,patch]." | ||
required: False | ||
default: "patch" | ||
outputs: | ||
current_version: | ||
description: "The current version." | ||
next_version: | ||
description: "The next major version." | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
|
||
branding: | ||
icon: "corner-right-up" | ||
color: "gray-dark" |
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 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -n "${GITHUB_WORKSPACE}" ]; then | ||
cd "${GITHUB_WORKSPACE}" || exit | ||
fi | ||
|
||
input_bump_level="$(echo $INPUT_BUMP_LEVEL | tr '[:upper:]' '[:lower:]')" # Make lowercase | ||
case $input_bump_level in | ||
"major"|"minor"|"patch") | ||
;; | ||
*) | ||
printf '%s\n' "Please specify a valid bump level \`${input_bump_level}\` is not valid [major, minor, patch]." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
git fetch --tags # Fetch existing tags before bump. | ||
# Fetch history as well because bump uses git history (git tag --merged). | ||
git fetch --prune --unshallow | ||
CURRENT_VERSION="$(bump current)" || true | ||
NEXT_VERSION="$(bump ${input_bump_level})" || true | ||
|
||
echo "::set-output name=current_version::${CURRENT_VERSION}" | ||
echo "::set-output name=next_version::${NEXT_VERSION}" |