generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 15
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
0 parents
commit ae09066
Showing
5 changed files
with
103 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,12 @@ | ||
FROM ruby:2.6-alpine | ||
|
||
RUN apk add --no-cache git | ||
|
||
RUN set -x \ | ||
&& gem install bundler keycutter | ||
|
||
COPY LICENSE README.md / | ||
|
||
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 Jan Stastny | ||
|
||
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,36 @@ | ||
# Release Ruby Gem to GitHub Packages | ||
This action builds the gems for all `.gemspec` files in the projects root. | ||
|
||
## Example | ||
Example minimal workflow using this action: | ||
```yaml | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Build and publish gem | ||
uses: jstastny/publish-gem-to-github@master | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
owner: jstastny | ||
``` | ||
See example project using this action at [https://github.com/jstastny/testgem](https://github.com/jstastny/testgem). | ||
## Inputs | ||
| Name | Description | | ||
| -----| ------------| | ||
| `token` | GitHub token that has write access to Packages. You can use `secrets.GITHUB_TOKEN` | | ||
| `owner` | Name of the user or organization account that owns the repository containing your project | | ||
|
||
## Versioning your gem | ||
This action currently does not bump the gem's version when building it. It is up to you to do it (either manually or in a previous workflow step). | ||
If you try to release gem in the same version that already exists, the step will fail. |
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,16 @@ | ||
name: 'Release Gem to GitHub Packages' | ||
description: 'Builds and publishes Ruby gems to GitHub Packages' | ||
author: 'Jan Stastny' | ||
inputs: | ||
token: | ||
description: 'GitHub token that has access to write to GitHub package registry. You can use GITHUB_TOKEN for this.' | ||
required: true | ||
owner: | ||
description: 'Name of the user or organization account that owns the repository containing your project.' | ||
required: true | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.token }} | ||
- ${{ inputs.owner }} |
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,18 @@ | ||
#!/bin/sh -l | ||
|
||
GITHUB_TOKEN=$1 | ||
OWNER=$2 | ||
|
||
[ -z "${GITHUB_TOKEN}" ] && { echo "Missing input.token!"; exit 2; } | ||
[ -z "${OWNER}" ] && { echo "Missing input.owner!"; exit 2; } | ||
|
||
echo "Setting up access to GitHub Package Registry" | ||
mkdir -p ~/.gem | ||
touch ~/.gem/credentials | ||
chmod 600 ~/.gem/credentials | ||
echo ":github: Bearer ${GITHUB_TOKEN}" >> ~/.gem/credentials | ||
|
||
echo "Building the gem" | ||
gem build *.gemspec | ||
echo "Pushing the built gem to GitHub Package Registry" | ||
gem push --key github --host "https://rubygems.pkg.github.com/${OWNER}" *.gem |