Github Actions
Github Actions
GitHub Actions
2019/05/15
Bo-Yi Wu
https://github.com/appleboy
About me
• Software Engineer in Mediatek
https://blog.wu-boy.com
Develop
Develop
• Up to 3.75GB of memory
secrets = [ secrets = [
"PASSWORD", "PASSWORD",
] ]
args = [ args = [
"--user", "actions", "--user", "actions",
"--script", "whoami", "--script", "whoami",
] ]
main.workflow
secrets = [ secrets = [
"PASSWORD01", "PASSWORD02",
] ]
args = [ args = [
"-p", "$PASSWORD01", "-p", "$PASSWORD02",
"--script", "whoami", "--script", "whoami",
] ]
action "Publish" {
needs = "Tag"
uses = "actions/npm@master"
args = "publish --access public"
secrets = ["NPM_AUTH_TOKEN"]
}
How to add multiple
auth token
of npm registry?
kind: pipeline
name: default
steps:
- name: build
image: appleboy/drone-ssh
environment:
USERNAME:
from_secret: username
PASSWORD:
from_secret: password
Creating GitHub Actions
|-- ssh-action (repository)
| |__ .github
| |__ main.workflow
| |__ Dockerfile
| |__ entrypoint.sh
| |__ README.md
| |__ LICENSE
Support any language you want
Dockerfile
FROM appleboy/drone-ssh:1.5.0-linux-amd64
# Github labels
LABEL "com.github.actions.name"="SSH Commands"
LABEL "com.github.actions.description"="some description"
LABEL "com.github.actions.icon"="terminal"
LABEL “com.github.actions.color"="gray-dark"
LABEL "repository"="https://github.com/appleboy/ssh-action"
LABEL "homepage"="https://github.com/appleboy"
LABEL "maintainer"="Bo-Yi Wu <appleboy.tw@gmail.com>"
LABEL "version"="0.0.1"
set -eu
export GITHUB="true"
sh -c "/bin/drone-ssh $*"
action "Tag Docker Image" {
needs = ["build"]
uses = "actions/docker/cli@master"
args = "tag hello:$GITHUB_SHA"
}
action "Tag Docker Image" {
needs = ["build"]
uses = "actions/docker/cli@master"
args = ["tag", "hello:$GITHUB_SHA"]
}
Environment variables
action "Hello World" {
uses = "./my-action"
env = {
FIRST_NAME = "Mona"
MIDDLE_NAME = "Lisa"
LAST_NAME = "Octocat"
}
}
runtime environment
GitHub Variable
• GITHUB_WORKFLOW
• GITHUB_ACTION
• GITHUB_EVNETNAME
• GITHUB_SHA
• GITHUB_REF
I don’t know how to
get the author
email, name or
commit message
Publishing your action
in the GitHub Marketplace
FROM appleboy/drone-ssh:1.5.0-linux-amd64
# Github labels
LABEL "com.github.actions.name"="SSH Commands"
LABEL "com.github.actions.description"="some description"
LABEL "com.github.actions.icon"="terminal"
LABEL “com.github.actions.color"="gray-dark"
LABEL "repository"="https://github.com/appleboy/ssh-action"
LABEL "homepage"="https://github.com/appleboy"
LABEL "maintainer"="Bo-Yi Wu <appleboy.tw@gmail.com>"
LABEL "version"="0.0.1"
• appleboy/scp-action
• appleboy/facebook-action
• appleboy/telegram-action
• appleboy/jenkins-action
• appleboy/gitlab-ci-ation
• appleboy/discord-action
Thank You