์๊ฐ
์ด ๊ฐ์ด๋์์๋ ํจํค์ง๋ JavaScript ์์ ์ ๋ง๋ค๊ณ ์ฌ์ฉํ๋ ๋ฐ ํ์ํ ๊ธฐ๋ณธ ๊ตฌ์ฑ ์์์ ๋ํด ์์๋ด ๋๋ค. ์์ ์ ํจํค์งํ๋ ๋ฐ ํ์ํ ๊ตฌ์ฑ ์์์ ๊ฐ์ด๋์ ์ด์ ์ ๋ง์ถ๊ธฐ ์ํด ์์ ์ฝ๋์ ๊ธฐ๋ฅ์ ์ต์ํ๋ฉ๋๋ค. ์ฌ์ฉ์ ์ง์ ์ด๋ฆ์ ์ ๊ณตํ๋ฉด ๋ก๊ทธ์ "Hello World" ๋๋ "Hello [์ธ์ฌํ ์ฌ๋]"์ด ์ถ๋ ฅ๋ฉ๋๋ค.
์ด ๊ฐ์ด๋์์๋ GitHub Actions ๋๊ตฌ ํคํธ Node.js ๋ชจ๋์ ์ฌ์ฉํ์ฌ ๊ฐ๋ฐ ์๋๋ฅผ ํฅ์ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ actions/toolkit ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ฐธ์กฐํ์ธ์.
์ด ํ๋ก์ ํธ๋ฅผ ์๋ฃํ๋ฉด ์ฌ์ฉ์ ๊ณ ์ ์ JavaScript ์์ ์ ๋น๋ํ๊ณ ์ํฌํ๋ก์์ ํ ์คํธํ๋ ๋ฐฉ๋ฒ์ ์ดํดํ๊ฒ ๋ฉ๋๋ค.
JavaScript ์์ ์ด ๋ชจ๋ GitHub ํธ์คํธ๋ ์คํ๊ธฐ(Ubuntu, Windows ๋ฐ macOS)์ ํธํ๋๋๋ก ํ๋ ค๋ฉด ์์ฑํ๋ ํจํค์ง๋ JavaScript ์ฝ๋๋ ์์ JavaScript์ด๊ณ ๋ค๋ฅธ ์ด์ง ํ์ผ์ ์์กดํ์ง ์์์ผ ํฉ๋๋ค. JavaScript ์์ ์ ์คํ๊ธฐ์์ ์ง์ ์คํ๋๋ฉฐ ์คํ๊ธฐ ์ด๋ฏธ์ง์ ์ด๋ฏธ ์๋ ์ด์ง ํ์ผ์ ์ฌ์ฉํฉ๋๋ค.
๊ฒฝ๊ณ
์ํฌํ๋ก์ ์์ ์ ๋ง๋ค ๋๋ ์ฝ๋๊ฐ ๊ณต๊ฒฉ์์ ์ ๋ขฐํ ์ ์๋ ์ ๋ ฅ์ ์คํํ ์ ์๋์ง ํญ์ ๊ณ ๋ คํด์ผ ํฉ๋๋ค. ํน์ ์ปจํ ์คํธ๋ ๊ณต๊ฒฉ์๊ฐ ์์ ์ ์ ์ฑ ์ฝํ ์ธ ๋ฅผ ์ฝ์ ํ ์ ์์ผ๋ฏ๋ก ์ ๋ขฐํ ์ ์๋ ์ ๋ ฅ์ผ๋ก ์ทจ๊ธํด์ผ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ณด์ ์ฌ์ฉ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
ํ์ ์กฐ๊ฑด
์์ํ๊ธฐ ์ ์ Node.js๋ฅผ ๋ค์ด๋ก๋ํ๊ณ ํผ๋ธ๋ฆญ GitHub ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ง๋ค์ด์ผ ํฉ๋๋ค.
-
npm์ ํฌํจํ๋ Node.js 20.x๋ฅผ ๋ค์ด๋ก๋ํ์ฌ ์ค์นํฉ๋๋ค.
-
GitHub์ ์ ํผ๋ธ๋ฆญ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ง๋ค๊ณ "hello-world-javascript-action"์ด๋ผ๊ณ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ง๋ค๊ธฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
-
์ปดํจํฐ์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ณต์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ณต์ ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
-
ํฐ๋ฏธ๋์์ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ก ๋ณ๊ฒฝํฉ๋๋ค.
Shell cd hello-world-javascript-action
cd hello-world-javascript-action
-
ํฐ๋ฏธ๋์์ npm์ผ๋ก ๋๋ ํฐ๋ฆฌ๋ฅผ ์ด๊ธฐํํ์ฌ
package.json
ํ์ผ์ ์์ฑํฉ๋๋ค.Shell npm init -y
npm init -y
์์ ๋ฉํ๋ฐ์ดํฐ ํ์ผ ๋ง๋ค๊ธฐ
๋ค์ ์์ ์ฝ๋๋ฅผ ์ฌ์ฉํ์ฌ hello-world-javascript-action
๋๋ ํฐ๋ฆฌ์ action.yml
์ด๋ผ๋ ์ ํ์ผ์ ๋ง๋ญ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ฉํ๋ฐ์ดํฐ ๊ตฌ๋ฌธ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
name: Hello World description: Greet someone and record the time inputs: who-to-greet: # id of input description: Who to greet required: true default: World outputs: time: # id of output description: The time we greeted you runs: using: node20 main: dist/index.js
name: Hello World
description: Greet someone and record the time
inputs:
who-to-greet: # id of input
description: Who to greet
required: true
default: World
outputs:
time: # id of output
description: The time we greeted you
runs:
using: node20
main: dist/index.js
์ด ํ์ผ์ who-to-greet
์
๋ ฅ ๋ฐ time
์ถ๋ ฅ์ ์ ์ํฉ๋๋ค. ๋ํ ์์
์คํ๊ธฐ์์ JavaScript ์์
์คํ์ ์์ํ๋ ๋ฐฉ๋ฒ์ ์๋ ค์ค๋๋ค.
์์ ๋๊ตฌ ํคํธ ํจํค์ง ์ถ๊ฐ
์์ ๋๊ตฌ ํคํธ๋ ๋ ์ผ๊ด์ ์ผ๋ก JavaScript ์์ ์ ๋น ๋ฅด๊ฒ ๋น๋ํ ์ ์๋ Node.js ํจํค์ง์ ์ปฌ๋ ์ ์ ๋๋ค.
๋๊ตฌ ํคํธ @actions/core
ํจํค์ง๋ ์ํฌํ๋ก ๋ช
๋ น, ์
๋ ฅ ๋ฐ ์ถ๋ ฅ ๋ณ์, ์ข
๋ฃ ์ํ, ๋๋ฒ๊ทธ ๋ฉ์์ง์ ๋ํ ์ธํฐํ์ด์ค๋ฅผ ์ ๊ณตํฉ๋๋ค.
๋๊ตฌ ํคํธ๋ ๋ํ ์ธ์ฆ๋ Octokit REST ํด๋ผ์ด์ธํธ์ GitHub Actions ์ปจํ
์คํธ์ ๋ํ ์ก์ธ์ค๋ฅผ ๋ฐํํ๋ @actions/github
ํจํค์ง๋ ์ ๊ณตํฉ๋๋ค.
๋๊ตฌ ํคํธ๋ core
๋ฐ github
ํจํค์ง ์ด์์ ์ ๊ณตํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ actions/toolkit ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ฐธ์กฐํ์ธ์.
ํฐ๋ฏธ๋์์ ์์
๋๊ตฌ ํคํธ core
๋ฐ github
ํจํค์ง๋ฅผ ์ค์นํฉ๋๋ค.
npm install @actions/core @actions/github
npm install @actions/core @actions/github
์ด์ ์ค์น๋ ๋ชจ๋ ์ข
์์ฑ๊ณผ ์ข
์์ฑ์ ๋ฒ์ ์ ์ถ์ ํ๋ node_modules
๋๋ ํฐ๋ฆฌ์ package-lock.json
ํ์ผ์ด ํ์๋ฉ๋๋ค. node_modules
๋๋ ํฐ๋ฆฌ๋ฅผ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ปค๋ฐํด์๋ ์ ๋ฉ๋๋ค.
์์ ์ฝ๋ ์์ฑ
์ด ์์
์ ๋๊ตฌ ํคํธ๋ฅผ ์ฌ์ฉํ์ฌ ์์
์ ๋ฉํ๋ฐ์ดํฐ ํ์ผ์ ํ์ํ who-to-greet
์
๋ ฅ ๋ณ์๋ฅผ ๊ฐ์ ธ์ค๊ณ ๋ก๊ทธ์ ๋๋ฒ๊ทธ ๋ฉ์์ง์ "Hello [who-to-greet]"๋ฅผ ์ถ๋ ฅํฉ๋๋ค. ๋ค์์ผ๋ก ์คํฌ๋ฆฝํธ๋ ํ์ฌ ์๊ฐ์ ๊ฐ์ ธ์ค๊ณ ๋์ค์ ์์
์์ ์คํ๋๋ ์์
์์ ์ฌ์ฉํ ์ ์๋ ์ถ๋ ฅ ๋ณ์๋ก ์ค์ ํฉ๋๋ค.
GitHub Actions๋ ์นํํฌ ์ด๋ฒคํธ, Git ReFS, ์ํฌํ๋ก, ์์
, ์ํฌํ๋ก๋ฅผ ํธ๋ฆฌ๊ฑฐํ ์ฌ๋์ ๋ํ ์ปจํ
์คํธ ์ ๋ณด๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ปจํ
์คํธ ์ ๋ณด์ ์ก์ธ์คํ๋ ค๋ฉด github
ํจํค์ง๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์์ฑํ ์์
์ ์นํํฌ ์ด๋ฒคํธ ํ์ด๋ก๋๋ฅผ ๋ก๊ทธ์ ์ถ๋ ฅํฉ๋๋ค.
๋ค์ ์ฝ๋๋ฅผ ์ฌ์ฉํ์ฌ src/index.js
๋ผ๋ ์ ํ์ผ์ ์ถ๊ฐํฉ๋๋ค.
import * as core from "@actions/core"; import * as github from "@actions/github"; try { // `who-to-greet` input defined in action metadata file const nameToGreet = core.getInput("who-to-greet"); core.info(`Hello ${nameToGreet}!`); // Get the current time and set it as an output variable const time = new Date().toTimeString(); core.setOutput("time", time); // Get the JSON webhook payload for the event that triggered the workflow const payload = JSON.stringify(github.context.payload, undefined, 2); core.info(`The event payload: ${payload}`); } catch (error) { core.setFailed(error.message); }
import * as core from "@actions/core";
import * as github from "@actions/github";
try {
// `who-to-greet` input defined in action metadata file
const nameToGreet = core.getInput("who-to-greet");
core.info(`Hello ${nameToGreet}!`);
// Get the current time and set it as an output variable
const time = new Date().toTimeString();
core.setOutput("time", time);
// Get the JSON webhook payload for the event that triggered the workflow
const payload = JSON.stringify(github.context.payload, undefined, 2);
core.info(`The event payload: ${payload}`);
} catch (error) {
core.setFailed(error.message);
}
์ index.js
์์ ์์ ์ค๋ฅ๊ฐ throw๋๋ฉด core.setFailed(error.message);
๋ ์์
๋๊ตฌ ํคํธ @actions/core
ํจํค์ง๋ฅผ ์ฌ์ฉํ์ฌ ๋ฉ์์ง๋ฅผ ๊ธฐ๋กํ๊ณ ์คํจํ ์ข
๋ฃ ์ฝ๋๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ์์
์ ์ข
๋ฃ ์ฝ๋ ์ค์ ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์ถ๊ฐ ์ ๋ณด ๋ง๋ค๊ธฐ
์ฌ๋๋ค์๊ฒ ์์ ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์๋ฆฌ๊ธฐ ์ํด ์ถ๊ฐ ์ ๋ณด ํ์ผ์ ๋ง๋ค ์ ์์ต๋๋ค. ์ถ๊ฐ ์ ๋ณด๋ ์์ ์ ๊ณต๊ฐ์ ์ผ๋ก ๊ณต์ ํ๋ ค๋ ๊ฒฝ์ฐ์ ๊ฐ์ฅ ์ ์ฉํ์ง๋ง ์ฌ์ฉ์ ๋๋ ํ์๊ฒ ์์ ์ฌ์ฉ ๋ฐฉ๋ฒ์ ์๋ ค์ฃผ๋ ์ข์ ๋ฐฉ๋ฒ์ด๊ธฐ๋ ํฉ๋๋ค.
hello-world-javascript-action
๋๋ ํฐ๋ฆฌ์์ ๋ค์ ์ ๋ณด๋ฅผ ์ง์ ํ๋ README.md
ํ์ผ์ ๋ง๋ญ๋๋ค.
- ์์ ์ด ์ํํ๋ ์์ ์ ๋ํ ์์ธํ ์ค๋ช ์ ๋๋ค.
- ํ์ ์ ๋ ฅ ๋ฐ ์ถ๋ ฅ ์ธ์์ ๋๋ค.
- ์ ํ์ ์ ๋ ฅ ๋ฐ ์ถ๋ ฅ ์ธ์์ ๋๋ค.
- ์์ ์์ ์ฌ์ฉํ๋ ๋น๋ฐ์ ๋๋ค.
- ์์ ์์ ์ฌ์ฉํ๋ ํ๊ฒฝ ๋ณ์์ ๋๋ค.
- ์ํฌํ๋ก์์ ์์ ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์์ ๋๋ค.
# Hello world JavaScript action This action prints "Hello World" or "Hello" + the name of a person to greet to the log. ## Inputs ### `who-to-greet` **Required** The name of the person to greet. Default `"World"`. ## Outputs ### `time` The time we greeted you. ## Example usage ```yaml uses: actions/hello-world-javascript-action@e76147da8e5c81eaf017dede5645551d4b94427b with: who-to-greet: Mona the Octocat ```
# Hello world JavaScript action
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
## Inputs
### `who-to-greet`
**Required** The name of the person to greet. Default `"World"`.
## Outputs
### `time`
The time we greeted you.
## Example usage
```yaml
uses: actions/hello-world-javascript-action@e76147da8e5c81eaf017dede5645551d4b94427b
with:
who-to-greet: Mona the Octocat
```
์์ ์ ์ปค๋ฐ, ํ๊ทธ ์ง์ , ํธ์
GitHub๋ ๋ฐํ์ ์ค์ ์ํฌํ๋ก์์ ์คํ๋๋ ๊ฐ ์์
์ ๋ค์ด๋ก๋ํ๊ณ ์ ์ฒด ์ฝ๋ ํจํค์ง๋ก ์คํํ ํ run
๊ณผ ๊ฐ์ ์ํฌํ๋ก ๋ช
๋ น์ ์ฌ์ฉํ์ฌ ์คํ๊ธฐ ๋จธ์ ๊ณผ ์ํธ ์์ฉ์ ํ ์ ์์ต๋๋ค. ์ฆ, JavaScript ์ฝ๋๋ฅผ ์คํํ๋ ๋ฐ ํ์ํ ํจํค์ง ์ข
์์ฑ์ ํฌํจํด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ด ์์
์์๋ @actions/core
๋ฐ @actions/github
ํจํค์ง๋ฅผ ์ฌ์ฉํฉ๋๋ค.
node_modules
๋๋ ํฐ๋ฆฌ๋ฅผ ์ฒดํฌ ์ธํ๋ฉด ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก, rollup.js
๋๋ @vercel/ncc
๋ฑ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๋์ ์ข
์์ฑ์ ํ๋์ ํ์ผ์ ๊ฒฐํฉํ์ฌ ๋ฐฐํฌํ ์ ์์ต๋๋ค.
-
ํฐ๋ฏธ๋์์ ์ด ๋ช ๋ น์ ์คํํ์ฌ
rollup
๋ฐ ํด๋น ํ๋ฌ๊ทธ์ธ์ ์ค์นํ์ธ์.npm install --save-dev rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve
-
๋ค์ ์ฝ๋๋ฅผ ์ฌ์ฉํ์ฌ
rollup.config.js
๋ผ๋ ์ ํ์ผ์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฃจํธ์ ๋ง๋ญ๋๋ค.JavaScript import commonjs from "@rollup/plugin-commonjs"; import { nodeResolve } from "@rollup/plugin-node-resolve"; const config = { input: "src/index.js", output: { esModule: true, file: "dist/index.js", format: "es", sourcemap: true, }, plugins: [commonjs(), nodeResolve({ preferBuiltins: true })], }; export default config;
import commonjs from "@rollup/plugin-commonjs"; import { nodeResolve } from "@rollup/plugin-node-resolve"; const config = { input: "src/index.js", output: { esModule: true, file: "dist/index.js", format: "es", sourcemap: true, }, plugins: [commonjs(), nodeResolve({ preferBuiltins: true })], }; export default config;
-
dist/index.js
ํ์ผ์ ์ปดํ์ผํฉ๋๋ค.rollup --config rollup.config.js
์ฝ๋์ ์ข ์์ฑ์ด ํฌํจ๋ ์
dist/index.js
ํ์ผ์ด ํ์๋ฉ๋๋ค. -
ํฐ๋ฏธ๋์์ ์ ๋ฐ์ดํธ๋ฅผ ์ปค๋ฐํฉ๋๋ค.
Shell git add src/index.js dist/index.js rollup.config.js package.json package-lock.json README.md action.yml git commit -m "Initial commit of my first action" git tag -a -m "My first action release" v1.1 git push --follow-tags
git add src/index.js dist/index.js rollup.config.js package.json package-lock.json README.md action.yml git commit -m "Initial commit of my first action" git tag -a -m "My first action release" v1.1 git push --follow-tags
์ฝ๋๋ฅผ ์ปค๋ฐํ๊ณ ํธ์ํ ๋, ์ ๋ฐ์ดํธ๋ ๋ฆฌํฌ์งํ ๋ฆฌ๋ ๋ค์๊ณผ ๊ฐ์ด ํ์๋ฉ๋๋ค.
hello-world-javascript-action/
โโโ action.yml
โโโ dist/
โ โโโ index.js
โโโ package.json
โโโ package-lock.json
โโโ README.md
โโโ rollup.config.js
โโโ src/
โโโ index.js
์ํฌํ๋ก์์ ์์ ํ ์คํธ
์ด์ ์ํฌํ๋ก์์ ์์ ์ ํ ์คํธํ ์ค๋น๊ฐ ๋์์ต๋๋ค.
ํผ๋ธ๋ฆญ ์์ ์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ํฌํ๋ก์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์์ ์ด ํ๋ผ์ด๋น ๋๋ ๋ด๋ถ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์๋ ๊ฒฝ์ฐ ๋ฆฌํฌ์งํ ๋ฆฌ ์ค์ ์ ๋์ผํ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ด์์๋ง ์์ ์ ์ฌ์ฉํ ์ ์๋์ง ๋๋ ๋์ผํ ์กฐ์ง ๋๋ ์ํฐํ๋ผ์ด์ฆ์์ ์์ ํ ๋ค๋ฅธ ๋ฆฌํฌ์งํ ๋ฆฌ์์๋ ์ฌ์ฉ ๊ฐ๋ฅํ์ง ์ฌ๋ถ๋ฅผ ์ง์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ฆฌํฌ์งํ ๋ฆฌ์ ๋ํ GitHub Actions ์ค์ ๊ด๋ฆฌ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
ํผ๋ธ๋ฆญ ์์ ์ ์ฌ์ฉํ๋ ์์
์ด ์์ ์์๋ ์ธ๋ถ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ด์์ ์ ํผ๋ธ๋ฆญ ์์ ์ ์คํํ ์ ์๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
๋ค์ YAML์ .github/workflows/main.yml
์ ์ ํ์ผ์ ๋ณต์ฌํ๊ณ ์์์ ๋ง๋ ํผ๋ธ๋ฆญ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ด๋ฆ๊ณผ ์ฌ์ฉ์ ์ด๋ฆ์ผ๋ก uses: octocat/hello-world-javascript-action@1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b
์ค์ ์
๋ฐ์ดํธํฉ๋๋ค. who-to-greet
์
๋ ฅ์ ์์ ์ ์ด๋ฆ์ผ๋ก ๋ฐ๊ฟ ์๋ ์์ต๋๋ค.
on: push: branches: - main jobs: hello_world_job: name: A job to say hello runs-on: ubuntu-latest steps: - name: Hello world action step id: hello uses: octocat/hello-world-javascript-action@1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b with: who-to-greet: Mona the Octocat # Use the output from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}"
on:
push:
branches:
- main
jobs:
hello_world_job:
name: A job to say hello
runs-on: ubuntu-latest
steps:
- name: Hello world action step
id: hello
uses: octocat/hello-world-javascript-action@1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b
with:
who-to-greet: Mona the Octocat
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"
์ด ์ํฌํ๋ก๊ฐ ํธ๋ฆฌ๊ฑฐ๋๋ฉด ์คํ๊ธฐ๋ ํผ๋ธ๋ฆญ ๋ฆฌํฌ์งํ ๋ฆฌ์์ hello-world-javascript-action
์์
์ ๋ค์ด๋ก๋ํ ๋ค์ ์คํํฉ๋๋ค.
ํ๋ผ์ด๋น ์์ ์ ์ฌ์ฉํ๋ ์์
์์
๋ฆฌํฌ์งํ ๋ฆฌ์ .github/workflows/main.yml
ํ์ผ์ ์ํฌํ๋ก ์ฝ๋๋ฅผ ๋ณต์ฌํฉ๋๋ค. who-to-greet
์
๋ ฅ์ ์์ ์ ์ด๋ฆ์ผ๋ก ๋ฐ๊ฟ ์๋ ์์ต๋๋ค.
on: push: branches: - main jobs: hello_world_job: name: A job to say hello runs-on: ubuntu-latest steps: # To use this repository's private action, # you must check out the repository - name: Checkout uses: actions/checkout@v4 - name: Hello world action step uses: ./ # Uses an action in the root directory id: hello with: who-to-greet: Mona the Octocat # Use the output from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}"
on:
push:
branches:
- main
jobs:
hello_world_job:
name: A job to say hello
runs-on: ubuntu-latest
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v4
- name: Hello world action step
uses: ./ # Uses an action in the root directory
id: hello
with:
who-to-greet: Mona the Octocat
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"
๋ฆฌํฌ์งํ ๋ฆฌ์์ ์์ ํญ์ ํด๋ฆญํ๊ณ ์ต์ ์ํฌํ๋ก ์คํ์ ์ ํํฉ๋๋ค. ์์ ์๋ ๋๋ ์๊ฐํ ๊ทธ๋ํ์์ ์ธ์ฌํ ์์ ์ ํด๋ฆญํฉ๋๋ค.
Hello world ๋์ ๋จ๊ณ ํด๋ฆญํ๋ฉด โHello Mona Octocatโ ๋๋ who-to-greet
์
๋ ฅ์ ์ฌ์ฉํ ์ด๋ฆ์ด ๋ก๊ทธ์ ํ์๋์ด์ผ ํฉ๋๋ค.. ํ์์คํฌํ๋ฅผ ๋ณด๋ ค๋ฉด ์ถ๋ ฅ ์๊ฐ ๊ฐ์ ธ์ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
JavaScript ์์ ์ ๋ง๋ค๊ธฐ ์ํ ํ ํ๋ฆฟ ๋ฆฌํฌ์งํ ๋ฆฌ
GitHub์(๋) JavaScript ๋ฐ TypeScript ์์ ์ ๋ง๋ค๊ธฐ ์ํ ํ ํ๋ฆฟ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ด๋ฌํ ํ ํ๋ฆฟ์ ์ฌ์ฉํ์ฌ ํ ์คํธ, Linting ๋ฐ ๊ธฐํ ๊ถ์ฅ ์ฌ๋ก๋ฅผ ํฌํจํ๋ ์ ์์ ๋ง๋ค๊ธฐ๋ฅผ ๋น ๋ฅด๊ฒ ์์ํ ์ ์์ต๋๋ค.
GitHub.com์ JavaScript ์์ ์์
GitHub.com์์ JavaScript ์์ ์ ๋ง์ ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.