Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
カスタム GitHub Actions 超入門
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tomohiko Ozawa
August 10, 2023
Technology
3.8k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
カスタム GitHub Actions 超入門
Tomohiko Ozawa
August 10, 2023
More Decks by Tomohiko Ozawa
See All by Tomohiko Ozawa
ベンチャー入社後の3年間でDevOps実践して開発・運用体験を劇的に改善した話
kota65535
1
480
Other Decks in Technology
See All in Technology
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
140
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
120
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
17
6.4k
MIRU 2026 チュートリアル
keisuke198619
0
860
モバイルアプリ開発概論2026
recruitengineers
PRO
3
480
[しろおび夏祭り2026] チャットするAIから、作業するAIへ - 使われ方の変化と、その裏側で起きていること
kk0n
0
1.6k
AIエージェントを前提としたプラットフォーム エンジニアリング:GKEで作るAgent-Ready Golden Path
legalontechnologies
PRO
2
210
Cursor Meetup Sapporo - Cursor物語 続編
cocacola917
0
140
クラウドセキュリティ入門 ~安全なクラウド利用のための基礎知識~
lhazy
11
8.2k
Breaking the Seal: Static Deobfuscation of Compiled V8 JavaScript Bytecode Malware
hshrzd
0
620
グローバル基準のSREは、運用現場でどう機能したか:成熟度アセスメントの実践 / SRE NEXT 2026
sorawatanabe
0
130
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
53k
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
We Are The Robots
honzajavorek
0
290
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
280
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
400
Paper Plane
katiecoart
PRO
2
52k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
Fireside Chat
paigeccino
42
4k
Are puppies a ranking factor?
jonoalderson
1
3.8k
Transcript
© 2023 SRE Holdings Corporation 証券コード:2980 © 2023 SRE Holdings
Corporation GitHub Actions 2023/08/09 Oracle Cloud Hangout Cafe LT
© 2023 SRE Holdings Corporation SRE Holdings 2 2014 2019
SRE / AI DX DX IT
© 2023 SRE Holdings Corporation • ( @kota65535) • •
⁃ ⁃ ⁃ ⁃ CI/CD ⁃ 3
© 2023 SRE Holdings Corporation • Custom Actions • JavaScript
• Agenda 4
© 2023 SRE Holdings Corporation Custom Action
© 2023 SRE Holdings Corporation • • ⁃ ⁃ ⁃
⁃ Custom Actions 6
© 2023 SRE Holdings Corporation • JavaScript ⁃ Runner Node.js
JavaScript ⁃ : https://github.com/actions/hello-world-javascript-action • Docker ⁃ Runner Docker ⁃ ⁃ : https://github.com/actions/hello-world-docker-action • Composite ⁃ ⁃ : https://github.com/microsoft/action-python 7
© 2023 SRE Holdings Corporation JavaScript
© 2023 SRE Holdings Corporation • Minimal • https://github.com/kota65535/hello-world-javascript-action Minimal
JavaScript 9 . ├── README.md ├── action.yml ├── index.js ├── node_modules ├── package-lock.json └── package.json ⁃ action.yml • ⁃ index.js • JavaScript ⁃ node_modules • NPM node_modules ⁃ package.json & package-lock.json • NPM package.json
© 2023 SRE Holdings Corporation • • ⁃ ⁃ ⁃
⁃ ⁃ ⁃ action.yml 10
© 2023 SRE Holdings Corporation • inputs ⁃ Map ⁃
⁃ or not • outputs ⁃ Map • runs ⁃ ⁃ ⁃ JavaScript • using : Node • main : action.yml 11 inputs: who-to-greet: description: 'Who to greet' required: true default: 'World' outputs: time: description: 'The time we greeted you' runs: using: 'node16' main: 'index.js'
© 2023 SRE Holdings Corporation • JavaScript • @actions/core ⁃
JavaScript ⁃ index.js 12 const core = require('@actions/core'); try { // const nameToGreet = core.getInput('who-to-greet'); // core.info(`Hello ${nameToGreet}!`); ...
© 2023 SRE Holdings Corporation index.js 13 try { //
const nameToGreet = core.getInput('who-to-greet'); // core.info(`Hello ${nameToGreet}!`); // const time = (new Date()).toTimeString(); // core.setOutput("time", time); } catch (error) { // Fail core.setFailed(error.message); }
© 2023 SRE Holdings Corporation • • @actions/core • ⁃
@actions/github Octokit GitHub API package.json & package-lock.json 14 // Octokit const octokit = getOctokit(token); // Issue await octokit.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, "LGTM!" });
© 2023 SRE Holdings Corporation • index.js • ⁃ node_modules
Commit ⁃ ncc Bundle Commit • husky pre-commit • TypeScript • https://github.com/actions/typescript-action node_modules 15
© 2023 SRE Holdings Corporation • https://github.com/kota65535/hello-world-javascript-action-test • 16 steps:
- name: Checkout uses: actions/checkout@v3 - name: Greet uses: kota65535/hello-world-javascript-action@main with: who-to-greet: foo
© 2023 SRE Holdings Corporation 17
© 2023 SRE Holdings Corporation &
© 2023 SRE Holdings Corporation • Semantic Versioning : v1.2.3
• v1 • • Release 19 name: Release on: workflow_dispatch: inputs: version: description: Released version type: string required: true ...
© 2023 SRE Holdings Corporation Release 20 jobs: release: runs-on:
ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Configure git uses: kota65535/github-git-config-action@v1 with: user.name: Tomohiko Ozawa user.email:
[email protected]
- name: Get major version run: echo "MAJOR_VERSION=$(perl -ne 'print $1 if /^(.*?)\.(.*?)\.(.*?)$/' <<< '${{ inputs.version }}')" >> $GITHUB_ENV - name: Run npm version run: npm version ${{ inputs.version }} - name: Update the major version tag run: git tag -f v${{ env.MAJOR_VERSION }} - name: Push the version commit and tags run: | git pull --rebase --autostash git push origin HEAD git push -f --tags
© 2023 SRE Holdings Corporation • Release 21 main v1.2.4
v1 v1 v1.2.3
© 2023 SRE Holdings Corporation • GitHub Marketplace • ⁃
⁃ GitHub Marketplace 22
© 2023 SRE Holdings Corporation • name ⁃ ⁃ •
description ⁃ • branding ⁃ ⁃ icon • Feather ⁃ color • action.yml 23 name: "Terraform Plan to PR Comment" description: "Notify Terraform plan result as a pull request comment" branding: icon: "cloud" color: "purple"
© 2023 SRE Holdings Corporation • action.yml • Publish this
Action to the GitHub Marketplace 24
© 2023 SRE Holdings Corporation • ⁃ : Continuous Integration,
Security, Utilities, Chat • Publish release GitHub Marketplace 25
© 2023 SRE Holdings Corporation • 26
© 2023 SRE Holdings Corporation Custom Action CI/CD
© 2023 SRE Holdings Corporation