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
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
完全自律ロボットを作りたくて、先に開発を自律させた話(ROS Japan UG #63 LT)
rryz09
0
600
SRE Next 2026 何でも屋からの脱却
bto
0
730
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
110
Gen3R: 3D Scene Generation Meets Feed-Forward Reconstruction
spatial_ai_network
0
130
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
0
150
CIで使うClaude
iwatatomoya
0
260
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
4.6k
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
130
Amazon EVS で VCF 9.0 / 9.1 のサポート開始まとめ
mtoyoda
0
300
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
5.4k
ゴールデンパスは敷いただけでは道にならない ─ 企画部門のエンジニアが技術標準を事業価値に変えるまで
mhrtech
1
160
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
230
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
260
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Evolving SEO for Evolving Search Engines
ryanjones
0
240
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Rails Girls Zürich Keynote
gr2m
96
14k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Designing Powerful Visuals for Engaging Learning
tmiket
1
450
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
800
So, you think you're a good person
axbom
PRO
2
2.1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
The untapped power of vector embeddings
frankvandijk
2
1.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