Skip to content

Commit

Permalink
create mod action
Browse files Browse the repository at this point in the history
  • Loading branch information
k-kinzal committed Sep 24, 2019
0 parents commit dd0eaf1
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Update dependencies
on:
schedule:
- cron: '0 0 * * *'

jobs:
up:
name: mod up
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: chatwork/mod-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: up --build --pull-request
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

# Created by https://www.gitignore.io/api/intellij
# Edit at https://www.gitignore.io/?templates=intellij

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/
.idea/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

# End of https://www.gitignore.io/api/intellij
12 changes: 12 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pull_request_rules:
- name: automatic merge
conditions:
- base=master
- author=github-actions[bot]
actions:
merge:
method: merge
- name: delete head branch after merge
conditions: []
actions:
delete_head_branch: {}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM chatwork/mod:0.2.2

LABEL "com.github.actions.name"="variantdev/mod"
LABEL "com.github.actions.description"="Package manager for Makefile and Variantfile. Any set of files in Git/S3/GCS/HTTP as a reusable and parameterized module"
LABEL "com.github.actions.icon"="octagon"
LABEL "com.github.actions.color"="orange"

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MOD GitHub Actions

This GitHub Action runs the [mod](https://github.com/variantdev/mod) for package management.

## Usage

```yaml
name: Update dependencies
on:
schedule:
- cron: '0 0 * * *'

jobs:
up:
name: mod up
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: chatwork/mod-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: up --build --pull-request
```
For example, if you run `mod up --build --pull-request` regularly, a new PullRequest will be created when the package is updated.

## Environments

* `MOD_ACTION_WORKING_DIR`: The working directory where mod is run
14 changes: 14 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

cat << EOS > $HOME/.netrc
machine github.com
login ${GITHUB_ACTOR}
password ${GITHUB_TOKEN}
EOS

git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"

cd "${MOD_ACTION_WORKING_DIR:-.}"

exec mod "$@"
4 changes: 4 additions & 0 deletions variant.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
mod:
version: 0.2.2
previousVersion: 0.2.1
12 changes: 12 additions & 0 deletions variant.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
provisioners:
textReplace:
Dockerfile:
from: "FROM chatwork/mod:{{ .mod.previousVersion }}"
to: "FROM chatwork/mod:{{ .mod.version }}"

dependencies:
mod:
releasesFrom:
dockerImageTags:
source: chatwork/mod
version: "> 0.2.1"

0 comments on commit dd0eaf1

Please sign in to comment.