From 1bf06953d3f8cd025ca5ae431f0e39736980e862 Mon Sep 17 00:00:00 2001 From: nownabe Date: Thu, 9 Jan 2020 22:51:00 +0900 Subject: [PATCH] :tada: Initial Commit --- .github/workflows/build-image.yml | 31 +++++++++++++++++ .github/workflows/create-release.yml | 22 ++++++++++++ .github/workflows/update-majorver.yml | 15 ++++++++ Dockerfile | 12 +++++++ LICENSE | 21 +++++++++++ Makefile | 8 +++++ README.md | 50 +++++++++++++++++++++++++++ action.yaml | 14 ++++++++ entrypoint.sh | 3 ++ 9 files changed, 176 insertions(+) create mode 100644 .github/workflows/build-image.yml create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/update-majorver.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 action.yaml create mode 100755 entrypoint.sh diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..6a17843 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,31 @@ +name: Tests + +on: + pull_request: + push: + branches: + - master + +jobs: + + build: + name: Build Docker Image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Build Docker Image + run: docker build . + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Run Action + uses: ./ + with: + name: Action diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..428fafd --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,22 @@ +name: Create Release + +on: + push: + tags: + - 'v*' + +jobs: + + create-release: + name: Create Release + runs-on: ubuntu-latest + steps: + - uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/.github/workflows/update-majorver.yml b/.github/workflows/update-majorver.yml new file mode 100644 index 0000000..ee0cae3 --- /dev/null +++ b/.github/workflows/update-majorver.yml @@ -0,0 +1,15 @@ +name: Update Major Version Tag + +on: + push: + tags: + - "v*" + +jobs: + update-majorver: + name: Update Major Version Tag + runs-on: ubuntu-latest + steps: + - uses: nowactions/update-majorver@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..198556b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3.11.2 + +LABEL version="0.0.1" +LABEL maintainer="nownabe" +LABEL com.github.actions.name="Action Template" +LABEL com.github.actions.description="Template for GitHub Action" +LABEL com.github.actions.icon="file-text" +LABEL com.github.actions.color="red" + +COPY ./entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..42d0dc0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 nownabe + +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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c77dac6 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +SHELL = bash + +VERSION := v$(shell grep -m1 version Dockerfile awk -F= '{ print $$2 }' | sed 's/[\",]//g') + +.PHONY: release +release: + git tag -a $(VERSION) -m $(VERSION) + git push --tags diff --git a/README.md b/README.md new file mode 100644 index 0000000..4ed3b37 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# GitHub Action: Hello Docker + +[![Tests](https://github.com/nowactions/template-docker/workflows/Tests/badge.svg)](https://github.com/nowactions/template-docker/actions) +[![Release](https://img.shields.io/github/release/nowactions/template-docker.svg)](https://github.com/nowactions/template-docker/releases) +[![License](https://img.shields.io/github/license/nowactions/template-docker)](LICENSE) + +This GitHub Action is a template for GitHub Action with Dockerfile. + +## Usage + +### Prerequisites + +Create a workflow `.yml` file in your `.github/workflows` directory. +An [example workflow](#example) is available below. +For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file). + +### Inputs + +- `name`: Name to greet + +## Example + +```yml +name: Greet + +on: + push: + branch: + - master + +jobs: + greet: + name: Greet + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: Greet + uses: nowactions/template-docker@master + with: + name: GitHub Action +``` + +## Development + +### Release + +* Bump up the version in Dockerfile +* Commit the changes +* Run `make release` diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..6b0bca1 --- /dev/null +++ b/action.yaml @@ -0,0 +1,14 @@ +name: Template for Docker Action +author: nownabe +description: Template for Docker Action +inputs: + name: + description: Name to greet + required: false + default: World +runs: + using: docker + image: Dockerfile +branding: + color: red + icon: file-text diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..0f94f59 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Hello, ${INPUT_NAME}"