์ฐธ๊ณ ํญ๋ชฉ
GitHub ํธ์คํธ ์คํ๊ธฐ๋ ํ์ฌ GitHub Enterprise Server์์ ์ง์๋์ง ์์ต๋๋ค.
์ํฌํ๋ก ๋ช ๋ น ์ ๋ณด
์์ ์ ์คํ๊ธฐ ์ปดํจํฐ์ ํต์ ํ์ฌ ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ๊ณ , ๋ค๋ฅธ ์์ ์์ ์ฌ์ฉํ๋ ๊ฐ์ ์ถ๋ ฅํ๊ณ , ์ถ๋ ฅ ๋ก๊ทธ์ ๋๋ฒ๊ทธ ๋ฉ์์ง๋ฅผ ์ถ๊ฐํ๋ ๋ฑ ๋ค์ํ ์์ ์ ์ํํ ์ ์์ต๋๋ค.
๋๋ถ๋ถ์ ์ํฌํ๋ก ๋ช
๋ น์ ํน์ ํ์์ผ๋ก echo
๋ช
๋ น์ ์ฌ์ฉํ๋ ๋ฐ๋ฉด ํ์ผ์ ์์ฑํ์ฌ ํธ์ถํ ์ ์๋ ๋ช
๋ น๋ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ํ๊ฒฝ ํ์ผ์ ์ฐธ์กฐํ์ธ์.
์ํฌํ๋ก ๋ช ๋ น์ ์์
echo "::workflow-command parameter1={data},parameter2={data}::{command value}"
echo "::workflow-command parameter1={data},parameter2={data}::{command value}"
Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}"
Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}"
์ฐธ๊ณ ํญ๋ชฉ
์ํฌํ๋ก ๋ช ๋ น ๋ฐ ๋งค๊ฐ ๋ณ์ ์ด๋ฆ์ ๋/์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ์ง ์์ต๋๋ค.
๊ฒฝ๊ณ
๋ช
๋ น ํ๋กฌํํธ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ํฌํ๋ก ๋ช
๋ น์ ์ฌ์ฉํ ๋ ํฐ๋ฐ์ดํ("
)๋ฅผ ์๋ตํฉ๋๋ค.
์ํฌํ๋ก ๋ช ๋ น์ ์ฌ์ฉํ์ฌ ๋๊ตฌ ํคํธ ํจ์์ ์ก์ธ์ค
์์
/๋๊ตฌ ํคํธ์๋ ์ํฌํ๋ก ๋ช
๋ น์ผ๋ก ์คํํ ์ ์๋ ์ฌ๋ฌ ํจ์๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. ::
๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ฌ YAML ํ์ผ ๋ด์์ ์ํฌํ๋ก ๋ช
๋ น์ ์คํํฉ๋๋ค. ๊ทธ๋ฌ๋ฉด ํด๋น ๋ช
๋ น์ด stdout
์ ํตํด ์คํ๊ธฐ๋ก ์ ์ก๋ฉ๋๋ค.
์๋ฅผ ๋ค์ด ์ฝ๋๋ฅผ ์ฌ์ฉํ๋ ๋์ ์๋์ ๊ฐ์ด ์ค๋ฅ ์ฃผ์์ ๋ง๋ค ์ ์์ต๋๋ค.
core.error('Missing semicolon', {file: 'app.js', startLine: 1})
core.error('Missing semicolon', {file: 'app.js', startLine: 1})
์: ์ค๋ฅ์ ๋ํ ์ฃผ์ ๋ง๋ค๊ธฐ
์ํฌํ๋ก์ error
๋ช
๋ น์ ์ฌ์ฉํ์ฌ ๋์ผํ ์ค๋ฅ ์ฃผ์์ ๋ง๋ค ์ ์์ต๋๋ค.
- name: Create annotation for build error run: echo "::error file=app.js,line=1::Missing semicolon"
- name: Create annotation for build error
run: echo "::error file=app.js,line=1::Missing semicolon"
- name: Create annotation for build error run: Write-Output "::error file=app.js,line=1::Missing semicolon"
- name: Create annotation for build error
run: Write-Output "::error file=app.js,line=1::Missing semicolon"
๋ค์ ํ์์๋ ์ํฌํ๋ก ๋ด์์ ์ฌ์ฉํ ์ ์๋ ๋๊ตฌ ํคํธ ํจ์๋ฅผ ๋ณด์ฌ ์ค๋๋ค.
๋๊ตฌ ํคํธ ํจ์ | ๋๋ฑํ ์ํฌํ๋ก ๋ช ๋ น |
---|---|
core.addPath | GITHUB_PATH ํ๊ฒฝ ํ์ผ์ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.debug | debug |
core.notice | notice |
core.error | error |
core.endGroup | endgroup |
core.exportVariable | GITHUB_ENV ํ๊ฒฝ ํ์ผ์ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.getInput | INPUT_{NAME} ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.getState | STATE_{NAME} ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.isDebug | RUNNER_DEBUG ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.summary | GITHUB_STEP_SUMMARY ํ๊ฒฝ ํ์ผ์ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.saveState | GITHUB_STATE ํ๊ฒฝ ํ์ผ์ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.setCommandEcho | echo |
core.setFailed | ::error ๋ฐ exit 1 ์ ๋ํ ๋ฐ๋ก ๊ฐ๊ธฐ๋ก ์ฌ์ฉ |
core.setOutput | GITHUB_OUTPUT ํ๊ฒฝ ํ์ผ์ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ ์ ์์ |
core.setSecret | add-mask |
core.startGroup | group |
core.warning | warning |
๋๋ฒ๊ทธ ๋ฉ์์ง ์ค์
๋๋ฒ๊ทธ ๋ฉ์์ง๋ฅผ ๋ก๊ทธ์ ์ถ๋ ฅํฉ๋๋ค. ๋ก๊ทธ์์ ์ด ๋ช
๋ น์ผ๋ก ์ค์ ๋ ๋๋ฒ๊ทธ ๋ฉ์์ง๋ฅผ ๋ณด๋ ค๋ฉด ์ด๋ฆ์ด ACTIONS_STEP_DEBUG
์ด๋ฉฐ ๊ฐ์ดtrue
์ธ ๋น๋ฐ์ ๋ง๋ค์ด์ผ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋๋ฒ๊ทธ ๋ก๊น
์ฌ์ฉ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
::debug::{message}
::debug::{message}
์์ : ๋๋ฒ๊ทธ ๋ฉ์์ง ์ค์
echo "::debug::Set the Octocat variable"
echo "::debug::Set the Octocat variable"
Write-Output "::debug::Set the Octocat variable"
Write-Output "::debug::Set the Octocat variable"
์๋ฆผ ๋ฉ์์ง ์ค์
์๋ฆผ ๋ฉ์์ง๋ฅผ ๋ง๋ค๊ณ ๋ฉ์์ง๋ฅผ ๋ก๊ทธ์ ์ถ๋ ฅํฉ๋๋ค. ์ด ๋ฉ์์ง๋ ๋ฆฌํฌ์งํ ๋ฆฌ์ ํน์ ํ์ผ๊ณผ ๋ฉ์์ง๋ฅผ ์ฐ๊ฒฐํ ์ ์๋ ์ฃผ์์ ๋ง๋ญ๋๋ค. ํ์์ ๋ฐ๋ผ ๋ฉ์์ง๊ฐ ํ์ผ ๋ด์ ์์น๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
::notice file={name},line={line},endLine={endLine},title={title}::{message}
::notice file={name},line={line},endLine={endLine},title={title}::{message}
๋งค๊ฐ ๋ณ์ | ๊ฐ | Required | ๊ธฐ๋ณธ๊ฐ |
---|---|---|---|
title | ์ฌ์ฉ์ ์ง์ ์ ๋ชฉ | ์๋์ | None |
file | Filename | ์๋์ | .github |
col | ์ด ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | None |
endColumn | ๋ง์ง๋ง ์ด ๋ฒํธ | ์๋์ | None |
line | ํ ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | 1 |
endLine | ๋ง์ง๋ง ์ค ๋ฒํธ | ์๋์ | 1 |
์์ : ์๋ฆผ ๋ฉ์์ง ์ค์
echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon"
echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon"
Write-Output "::notice file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
Write-Output "::notice file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
๊ฒฝ๊ณ ๋ฉ์์ง ์ค์
๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ๋ง๋ค๊ณ ๋ฉ์์ง๋ฅผ ๋ก๊ทธ์ ์ถ๋ ฅํฉ๋๋ค. ์ด ๋ฉ์์ง๋ ๋ฆฌํฌ์งํ ๋ฆฌ์ ํน์ ํ์ผ๊ณผ ๋ฉ์์ง๋ฅผ ์ฐ๊ฒฐํ ์ ์๋ ์ฃผ์์ ๋ง๋ญ๋๋ค. ํ์์ ๋ฐ๋ผ ๋ฉ์์ง๊ฐ ํ์ผ ๋ด์ ์์น๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
::warning file={name},line={line},endLine={endLine},title={title}::{message}
::warning file={name},line={line},endLine={endLine},title={title}::{message}
๋งค๊ฐ ๋ณ์ | ๊ฐ | Required | ๊ธฐ๋ณธ๊ฐ |
---|---|---|---|
title | ์ฌ์ฉ์ ์ง์ ์ ๋ชฉ | ์๋์ | None |
file | Filename | ์๋์ | .github |
col | ์ด ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | None |
endColumn | ๋ง์ง๋ง ์ด ๋ฒํธ | ์๋์ | None |
line | ํ ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | 1 |
endLine | ๋ง์ง๋ง ์ค ๋ฒํธ | ์๋์ | 1 |
์์ : ๊ฒฝ๊ณ ๋ฉ์์ง ์ค์
echo "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
echo "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
Write-Output "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
Write-Output "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
์ค๋ฅ ๋ฉ์์ง ์ค์
์ค๋ฅ ๋ฉ์์ง๋ฅผ ๋ง๋ค๊ณ ๋ฉ์์ง๋ฅผ ๋ก๊ทธ์ ์ถ๋ ฅํฉ๋๋ค. ์ด ๋ฉ์์ง๋ ๋ฆฌํฌ์งํ ๋ฆฌ์ ํน์ ํ์ผ๊ณผ ๋ฉ์์ง๋ฅผ ์ฐ๊ฒฐํ ์ ์๋ ์ฃผ์์ ๋ง๋ญ๋๋ค. ํ์์ ๋ฐ๋ผ ๋ฉ์์ง๊ฐ ํ์ผ ๋ด์ ์์น๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
::error file={name},line={line},endLine={endLine},title={title}::{message}
::error file={name},line={line},endLine={endLine},title={title}::{message}
๋งค๊ฐ ๋ณ์ | ๊ฐ | Required | ๊ธฐ๋ณธ๊ฐ |
---|---|---|---|
title | ์ฌ์ฉ์ ์ง์ ์ ๋ชฉ | ์๋์ | None |
file | Filename | ์๋์ | .github |
col | ์ด ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | None |
endColumn | ๋ง์ง๋ง ์ด ๋ฒํธ | ์๋์ | None |
line | ํ ๋ฒํธ, 1๋ถํฐ ์์ | ์๋์ | 1 |
endLine | ๋ง์ง๋ง ์ค ๋ฒํธ | ์๋์ | 1 |
์์ : ์ค๋ฅ ๋ฉ์์ง ์ค์
echo "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
echo "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
Write-Output "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
Write-Output "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon"
๋ก๊ทธ ์ค ๊ทธ๋ฃนํ
๋ก๊ทธ์ ํ์ฅ ๊ฐ๋ฅํ ๊ทธ๋ฃน์ ๋ง๋ญ๋๋ค. ๊ทธ๋ฃน์ ๋ง๋ค๋ ค๋ฉด group
๋ช
๋ น์ ์ฌ์ฉํ๊ณ title
์ ์ง์ ํฉ๋๋ค. group
๋ช
๋ น๊ณผ endgroup
๋ช
๋ น ๊ฐ ๋ก๊ทธ์ ์ธ์ํ๋ ๋ชจ๋ ํญ๋ชฉ์ ๋ก๊ทธ์ ํ์ฅ ๊ฐ๋ฅํ ํญ๋ชฉ ๋ด์์ ์ค์ฒฉ๋ฉ๋๋ค.
::group::{title} ::endgroup::
::group::{title}
::endgroup::
์์ : ๋ก๊ทธ ์ ๊ทธ๋ฃนํ
jobs: bash-example: runs-on: ubuntu-latest steps: - name: Group of log lines run: | echo "::group::My title" echo "Inside group" echo "::endgroup::"
jobs:
bash-example:
runs-on: ubuntu-latest
steps:
- name: Group of log lines
run: |
echo "::group::My title"
echo "Inside group"
echo "::endgroup::"
jobs: powershell-example: runs-on: windows-latest steps: - name: Group of log lines run: | Write-Output "::group::My title" Write-Output "Inside group" Write-Output "::endgroup::"
jobs:
powershell-example:
runs-on: windows-latest
steps:
- name: Group of log lines
run: |
Write-Output "::group::My title"
Write-Output "Inside group"
Write-Output "::endgroup::"
๋ก๊ทธ์์ ๊ฐ ๋ง์คํน
::add-mask::{value}
::add-mask::{value}
๊ฐ์ ๋ง์คํนํ๋ฉด ๋ฌธ์์ด ๋๋ ๋ณ์๊ฐ ๋ก๊ทธ์ ์ถ๋ ฅ๋์ง ์์ต๋๋ค. ๋ง์คํน๋์ด ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถ๋ ๊ฐ ๋จ์ด๋ *
๋ฌธ์๋ก ๋์ฒด๋ฉ๋๋ค. ๋ง์คํฌ์ value
์ ํ๊ฒฝ ๋ณ์ ๋๋ ๋ฌธ์์ด์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๊ฐ์ ๋ง์คํนํ๋ฉด ๋น๋ฐ๋ก ์ฒ๋ฆฌ๋๊ณ ์คํ๊ธฐ์์ ํธ์ง๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด ๊ฐ์ ๋ง์คํนํ ํ์๋ ํด๋น ๊ฐ์ ์ถ๋ ฅ์ผ๋ก ์ค์ ํ ์ ์์ต๋๋ค.
์์ : ๋ฌธ์์ด ๋ง์คํน
๋ก๊ทธ์์ "Mona The Octocat"
์ ์ถ๋ ฅํ๋ฉด "***"
๊ฐ ํ์๋ฉ๋๋ค.
echo "::add-mask::Mona The Octocat"
echo "::add-mask::Mona The Octocat"
Write-Output "::add-mask::Mona The Octocat"
Write-Output "::add-mask::Mona The Octocat"
๊ฒฝ๊ณ
๋น๋ฐ์ ๋น๋ ๋ก๊ทธ์ ์ถ๋ ฅํ๊ฑฐ๋ ๋ค๋ฅธ ์ํฌํ๋ก ๋ช ๋ น์์ ์ฌ์ฉํ๊ธฐ ์ ์ โadd-maskโ์ ๋ฑ๋กํด์ผ ํฉ๋๋ค.
์์ : ํ๊ฒฝ ๋ณ์ ๋ง์คํน
๋ก๊ทธ์ MY_NAME
๋ณ์ ๋๋ "Mona The Octocat"
๊ฐ์ ์ถ๋ ฅํ ๋ "Mona The Octocat"
๋์ "***"
๊ฐ ํ์๋ฉ๋๋ค.
jobs: bash-example: runs-on: ubuntu-latest env: MY_NAME: "Mona The Octocat" steps: - name: bash-version run: echo "::add-mask::$MY_NAME"
jobs:
bash-example:
runs-on: ubuntu-latest
env:
MY_NAME: "Mona The Octocat"
steps:
- name: bash-version
run: echo "::add-mask::$MY_NAME"
jobs: powershell-example: runs-on: windows-latest env: MY_NAME: "Mona The Octocat" steps: - name: powershell-version run: Write-Output "::add-mask::$env:MY_NAME"
jobs:
powershell-example:
runs-on: windows-latest
env:
MY_NAME: "Mona The Octocat"
steps:
- name: powershell-version
run: Write-Output "::add-mask::$env:MY_NAME"
์: ๋จ์ผ ์์ ๋ด์์ ์์ฑ๋ ์ถ๋ ฅ ๋ง์คํน
ํ ์์ ์์ ๋ค๋ฅธ ์์ ์ผ๋ก ๋น๋ฐ์ ์ ๋ฌํ ํ์๊ฐ ์๋ ๊ฒฝ์ฐ ๋ค์์ ์ํํ ์ ์์ต๋๋ค.
- ๋น๋ฐ์ ์์ฑํฉ๋๋ค(์ถ๋ ฅํ์ง ์๊ณ ).
add-mask
(์ผ)๋ก ๋ง์คํนํฉ๋๋ค.- ์์
๋ด์ ๋ค๋ฅธ ๋จ๊ณ์์ ๋น๋ฐ์ ์ฌ์ฉํ ์ ์๋๋ก ํ๋ ๋ฐ
GITHUB_OUTPUT
์(๋ฅผ) ์ฌ์ฉํฉ๋๋ค.
on: push jobs: generate-a-secret-output: runs-on: ubuntu-latest steps: - id: sets-a-secret name: Generate, mask, and output a secret run: | the_secret=$((RANDOM)) echo "::add-mask::$the_secret" echo "secret-number=$the_secret" >> "$GITHUB_OUTPUT" - name: Use that secret output (protected by a mask) run: | echo "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"
on: push
jobs:
generate-a-secret-output:
runs-on: ubuntu-latest
steps:
- id: sets-a-secret
name: Generate, mask, and output a secret
run: |
the_secret=$((RANDOM))
echo "::add-mask::$the_secret"
echo "secret-number=$the_secret" >> "$GITHUB_OUTPUT"
- name: Use that secret output (protected by a mask)
run: |
echo "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"
on: push jobs: generate-a-secret-output: runs-on: ubuntu-latest steps: - id: sets-a-secret name: Generate, mask, and output a secret shell: pwsh run: | Set-Variable -Name TheSecret -Value (Get-Random) Write-Output "::add-mask::$TheSecret" "secret-number=$TheSecret" >> $env:GITHUB_OUTPUT - name: Use that secret output (protected by a mask) shell: pwsh run: | Write-Output "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"
on: push
jobs:
generate-a-secret-output:
runs-on: ubuntu-latest
steps:
- id: sets-a-secret
name: Generate, mask, and output a secret
shell: pwsh
run: |
Set-Variable -Name TheSecret -Value (Get-Random)
Write-Output "::add-mask::$TheSecret"
"secret-number=$TheSecret" >> $env:GITHUB_OUTPUT
- name: Use that secret output (protected by a mask)
shell: pwsh
run: |
Write-Output "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"
์: ์์ ๋๋ ์ํฌํ๋ก ๊ฐ์ ๋น๋ฐ ๋ง์คํน ๋ฐ ์ ๋ฌ
์์ ๋๋ ์ํฌํ๋ก ๊ฐ์ ๋ง์คํน๋ ๋น๋ฐ์ ์ ๋ฌํ๋ ค๋ฉด ์ ์ฅ์์ ๋น๋ฐ์ ์ ์ฅํ ๋ค์ ํ์ ์์ ๋๋ ์ํฌํ๋ก์์ ๊ฒ์ํด์ผ ํฉ๋๋ค.
์ค์
- ์ํฌํ๋ก ์ค์ ์์ฑํ ๋น๋ฐ์ ์ ์ฅํ๋๋ก ๋น๋ฐ ์ ์ฅ์๋ฅผ ์ค์ ํฉ๋๋ค. ์: Vault.
- ํด๋น ๋น๋ฐ ์ ์ฅ์๋ฅผ ์ฝ๊ณ ์ฐ๊ธฐ ์ํ ํค๋ฅผ ์์ฑํฉ๋๋ค. ํค๋ฅผ ๋ฆฌํฌ์งํ ๋ฆฌ ๋น๋ฐ๋ก ์ ์ฅํฉ๋๋ค. ๋ค์ ์์ ์ํฌํ๋ก์์ ๋น๋ฐ ์ด๋ฆ์
SECRET_STORE_CREDENTIALS
์ ๋๋ค. ์์ธํ ๋ด์ฉ์ GitHub Actions์์ ๋น๋ฐ ์ฌ์ฉ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์ํฌํ๋ก
์ฐธ๊ณ ํญ๋ชฉ
์ด ์ํฌํ๋ก๋ ๊ฐ์์ ๋ช
๋ น store-secret
๋ฐ retrieve-secret
๊ฐ ์๋ ๊ฐ์์ ๋น๋ฐ ์ ์ฅ์ secret-store
๋ฅผ ์ฌ์ฉํฉ๋๋ค. some/secret-store@ 27b31702a0e7fc50959f5ad993c78deac1bdfc29
์(๋) secret-store
์ ํ๋ฆฌ์ผ์ด์
์ ์ค์นํ๊ณ credentials
์(๋ฅผ) ํฌํจํ์ฌ instance
์(๊ณผ) ์ฐ๊ฒฐํ๋๋ก ๊ตฌ์ฑํ๋ ๊ฐ์ ์์
์
๋๋ค.
on: push jobs: secret-generator: runs-on: ubuntu-latest outputs: handle: ${{ steps.generate-secret.outputs.handle }} steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} instance: ${{ secrets.SECRET_STORE_INSTANCE }} - name: generate secret id: generate-secret shell: bash run: | GENERATED_SECRET=$((RANDOM)) echo "::add-mask::$GENERATED_SECRET" SECRET_HANDLE=$(secret-store store-secret "$GENERATED_SECRET") echo "handle=$SECRET_HANDLE" >> "$GITHUB_OUTPUT" secret-consumer: runs-on: macos-latest needs: secret-generator steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} instance: ${{ secrets.SECRET_STORE_INSTANCE }} - name: use secret shell: bash run: | SECRET_HANDLE="${{ needs.secret-generator.outputs.handle }}" RETRIEVED_SECRET=$(secret-store retrieve-secret "$SECRET_HANDLE") echo "::add-mask::$RETRIEVED_SECRET" echo "We retrieved our masked secret: $RETRIEVED_SECRET"
on: push
jobs:
secret-generator:
runs-on: ubuntu-latest
outputs:
handle: ${{ steps.generate-secret.outputs.handle }}
steps:
- uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }}
instance: ${{ secrets.SECRET_STORE_INSTANCE }}
- name: generate secret
id: generate-secret
shell: bash
run: |
GENERATED_SECRET=$((RANDOM))
echo "::add-mask::$GENERATED_SECRET"
SECRET_HANDLE=$(secret-store store-secret "$GENERATED_SECRET")
echo "handle=$SECRET_HANDLE" >> "$GITHUB_OUTPUT"
secret-consumer:
runs-on: macos-latest
needs: secret-generator
steps:
- uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }}
instance: ${{ secrets.SECRET_STORE_INSTANCE }}
- name: use secret
shell: bash
run: |
SECRET_HANDLE="${{ needs.secret-generator.outputs.handle }}"
RETRIEVED_SECRET=$(secret-store retrieve-secret "$SECRET_HANDLE")
echo "::add-mask::$RETRIEVED_SECRET"
echo "We retrieved our masked secret: $RETRIEVED_SECRET"
on: push jobs: secret-generator: runs-on: ubuntu-latest steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} instance: ${{ secrets.SECRET_STORE_INSTANCE }} - name: generate secret shell: pwsh run: | Set-Variable -Name Generated_Secret -Value (Get-Random) Write-Output "::add-mask::$Generated_Secret" Set-Variable -Name Secret_Handle -Value (Store-Secret "$Generated_Secret") "handle=$Secret_Handle" >> $env:GITHUB_OUTPUT secret-consumer: runs-on: macos-latest needs: secret-generator steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} instance: ${{ secrets.SECRET_STORE_INSTANCE }} - name: use secret shell: pwsh run: | Set-Variable -Name Secret_Handle -Value "${{ needs.secret-generator.outputs.handle }}" Set-Variable -Name Retrieved_Secret -Value (Retrieve-Secret "$Secret_Handle") echo "::add-mask::$Retrieved_Secret" echo "We retrieved our masked secret: $Retrieved_Secret"
on: push
jobs:
secret-generator:
runs-on: ubuntu-latest
steps:
- uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }}
instance: ${{ secrets.SECRET_STORE_INSTANCE }}
- name: generate secret
shell: pwsh
run: |
Set-Variable -Name Generated_Secret -Value (Get-Random)
Write-Output "::add-mask::$Generated_Secret"
Set-Variable -Name Secret_Handle -Value (Store-Secret "$Generated_Secret")
"handle=$Secret_Handle" >> $env:GITHUB_OUTPUT
secret-consumer:
runs-on: macos-latest
needs: secret-generator
steps:
- uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }}
instance: ${{ secrets.SECRET_STORE_INSTANCE }}
- name: use secret
shell: pwsh
run: |
Set-Variable -Name Secret_Handle -Value "${{ needs.secret-generator.outputs.handle }}"
Set-Variable -Name Retrieved_Secret -Value (Retrieve-Secret "$Secret_Handle")
echo "::add-mask::$Retrieved_Secret"
echo "We retrieved our masked secret: $Retrieved_Secret"
์ํฌํ๋ก ๋ช ๋ น ์ค์ง ๋ฐ ์์
์ํฌํ๋ก ๋ช ๋ น ์ฒ๋ฆฌ๋ฅผ ์ค์งํฉ๋๋ค. ์ด ํน์ ๋ช ๋ น์ ์ฌ์ฉํ๋ฉด ์ํฌํ๋ก ๋ช ๋ น์ ์ค์๋ก ์คํํ์ง ์๊ณ ๋ชจ๋ ํญ๋ชฉ์ ๊ธฐ๋กํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์ฃผ์์ด ์๋ ์ ์ฒด ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๋ ฅํ๊ธฐ ์ํด ๋ก๊น ์ ์ค์งํ ์ ์์ต๋๋ค.
::stop-commands::{endtoken}
::stop-commands::{endtoken}
์ํฌํ๋ก ๋ช
๋ น์ ์ฒ๋ฆฌ๋ฅผ ์ค์งํ๋ ค๋ฉด ๊ณ ์ ํ ํ ํฐ์ stop-commands
์ ์ ๋ฌํฉ๋๋ค. ์ํฌํ๋ก ๋ช
๋ น ์ฒ๋ฆฌ๋ฅผ ๊ณ์ํ๋ ค๋ฉด ์ํฌํ๋ก ๋ช
๋ น์ ์ค์งํ๋ ๋ฐ ์ฌ์ฉํ ๊ฒ๊ณผ ๋์ผํ ํ ํฐ์ ์ ๋ฌํฉ๋๋ค.
๊ฒฝ๊ณ
์ฌ์ฉ ์ค์ธ ํ ํฐ์ด ์์๋ก ์์ฑ๋๊ณ ๊ฐ ์คํ์ ๋ํด ๊ณ ์ ํด์ผ ํฉ๋๋ค.
::{endtoken}::
::{endtoken}::
์์ : ์ํฌํ๋ก ๋ช ๋ น ์ค์ง ๋ฐ ์์
jobs: workflow-command-job: runs-on: ubuntu-latest steps: - name: Disable workflow commands run: | echo '::warning:: This is a warning message, to demonstrate that commands are being processed.' stopMarker=$(uuidgen) echo "::stop-commands::$stopMarker" echo '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' echo "::$stopMarker::" echo '::warning:: This is a warning again, because stop-commands has been turned off.'
jobs:
workflow-command-job:
runs-on: ubuntu-latest
steps:
- name: Disable workflow commands
run: |
echo '::warning:: This is a warning message, to demonstrate that commands are being processed.'
stopMarker=$(uuidgen)
echo "::stop-commands::$stopMarker"
echo '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.'
echo "::$stopMarker::"
echo '::warning:: This is a warning again, because stop-commands has been turned off.'
jobs: workflow-command-job: runs-on: windows-latest steps: - name: Disable workflow commands run: | Write-Output '::warning:: This is a warning message, to demonstrate that commands are being processed.' $stopMarker = New-Guid Write-Output "::stop-commands::$stopMarker" Write-Output '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' Write-Output "::$stopMarker::" Write-Output '::warning:: This is a warning again, because stop-commands has been turned off.'
jobs:
workflow-command-job:
runs-on: windows-latest
steps:
- name: Disable workflow commands
run: |
Write-Output '::warning:: This is a warning message, to demonstrate that commands are being processed.'
$stopMarker = New-Guid
Write-Output "::stop-commands::$stopMarker"
Write-Output '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.'
Write-Output "::$stopMarker::"
Write-Output '::warning:: This is a warning again, because stop-commands has been turned off.'
์ด์ ๋ฐ ์ฌํ ์์ ์ ๊ฐ ๋ณด๋ด๊ธฐ
GITHUB_STATE
์ ์๋ ํ์ผ์ ์์ฑํ์ฌ ์ํฌํ๋ก์ pre:
๋๋ post:
์์
๊ณผ ๊ณต์ ํ ํ๊ฒฝ ๋ณ์๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด pre:
์์
์ ์ฌ์ฉํ์ฌ ํ์ผ์ ๋ง๋ค๊ณ , ํ์ผ ์์น๋ฅผ main:
์์
์ ์ ๋ฌํ ๋ค์, post:
์์
์ ์ฌ์ฉํ์ฌ ํ์ผ์ ์ญ์ ํ ์ ์์ต๋๋ค. ๋๋ main:
์์
์ ์ฌ์ฉํ์ฌ ํ์ผ์ ๋ง๋ค๊ณ , ํ์ผ ์์น๋ฅผ post:
์์
์ ์ ๋ฌํ ๋ค์, post:
์์
์ ์ฌ์ฉํ์ฌ ํ์ผ์ ์ญ์ ํ ์ ์์ต๋๋ค.
์ฌ๋ฌ pre:
๋๋ post:
์์
์ด ์ฌ๋ฌ ๊ฐ ์๋ ๊ฒฝ์ฐ ์ ์ฅ๋ ๊ฐ์ GITHUB_STATE
์ ๊ธฐ๋ก๋ ์์
์์๋ง ์ก์ธ์คํ ์ ์์ต๋๋ค. post:
์์
์ ๋ํ ์์ธํ ๋ด์ฉ์ ๋ฉํ๋ฐ์ดํฐ ๊ตฌ๋ฌธ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
GITHUB_STATE
ํ์ผ์ ์์
๋ด์์๋ง ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ ์ฅ๋ ๊ฐ์ ์ ๋์ฌ๊ฐ STATE_
์ธ ํ๊ฒฝ ๊ฐ์ผ๋ก ์ ์ฅ๋ฉ๋๋ค.
์ด ์์์์๋ JavaScript๋ฅผ ์ฌ์ฉํ์ฌ GITHUB_STATE
ํ์ผ์ ๊ธฐ๋กํฉ๋๋ค. ๊ฒฐ๊ณผ ํ๊ฒฝ ๋ณ์์ ์ด๋ฆ์ STATE_processID
์ด๋ฉฐ ๊ฐ์ 12345
์ด(๊ฐ) ๋ฉ๋๋ค.
import * as fs from 'fs' import * as os from 'os' fs.appendFileSync(process.env.GITHUB_STATE, `processID=12345${os.EOL}`, { encoding: 'utf8' })
import * as fs from 'fs'
import * as os from 'os'
fs.appendFileSync(process.env.GITHUB_STATE, `processID=12345${os.EOL}`, {
encoding: 'utf8'
})
๊ทธ๋ฐ ๋ค์ main
์์
์์ ์คํ๋๋ ์ ๋ฆฌ ์คํฌ๋ฆฝํธ์์๋ง STATE_processID
๋ณ์๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด ์์ ๋ main
์์ ์คํ๋๋ฉฐ JavaScript๋ฅผ ์ฌ์ฉํ์ฌ STATE_processID
ํ๊ฒฝ ๋ณ์์ ํ ๋น๋ ๊ฐ์ ํ์ํฉ๋๋ค.
console.log("The running PID from the main action is: " + process.env.STATE_processID);
console.log("The running PID from the main action is: " + process.env.STATE_processID);
ํ๊ฒฝ ํ์ผ
์ํฌํ๋ก๋ฅผ ์คํํ๋ ๋์ ์คํ๊ธฐ๋ ํน์ ์์
์ ์ํํ๋ ๋ฐ ์ฌ์ฉํ ์ ์๋ ์์ ํ์ผ์ ์์ฑํฉ๋๋ค. ์ด ํ์ผ์ ๊ฒฝ๋ก๋ GitHub์ ๊ธฐ๋ณธ ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ์ก์ธ์คํ๊ณ ํธ์งํ ์ ์์ต๋๋ค. ๋ณ์ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์. ํ์ผ์ ์ฝ๋๋ฅผ ์์ฑํ ๋์๋ ๋ช
๋ น์ ์ ์ ํ ์ฒ๋ฆฌ๋ฅผ ๋ณด์ฅํ๊ธฐ ์ํด UTF-8 ์ธ์ฝ๋ฉ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ๋์ผํ ํ์ผ์ ์ฌ๋ฌ ๋ช
๋ น์ ์ค ๋ฐ๊ฟ์ผ๋ก ๊ตฌ๋ถํ์ฌ ์์ฑํ ์ ์์ต๋๋ค.
GitHub ์์
์์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ํน์ GitHub Actions ๋ช
๋ น์ ์ฌ์ฉํ์ฌ .env
ํ์ผ์ ๋ง๋ค๊ฑฐ๋ ์์ ํฉ๋๋ค.
๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
name: Example Workflow for Environment Files on: push jobs: set_and_use_env_vars: runs-on: ubuntu-latest steps: - name: Set environment variable run: echo "MY_ENV_VAR=myValue" >> $GITHUB_ENV - name: Use environment variable run: | echo "The value of MY_ENV_VAR is $MY_ENV_VAR"
name: Example Workflow for Environment Files
on: push
jobs:
set_and_use_env_vars:
runs-on: ubuntu-latest
steps:
- name: Set environment variable
run: echo "MY_ENV_VAR=myValue" >> $GITHUB_ENV
- name: Use environment variable
run: |
echo "The value of MY_ENV_VAR is $MY_ENV_VAR"
๋ ๋ค๋ฅธ ์๋ ๋น๋ ํ์์คํฌํ, ์ปค๋ฐ SHA ๋๋ ์ํฐํฉํธ ์ด๋ฆ๊ณผ ๊ฐ์ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ ๋ฐ ์ฌ์ฉํ๋ ๊ฒ์ ๋๋ค.
steps: - name: Store build timestamp run: echo "BUILD_TIME=$(date +'%T')" >> $GITHUB_ENV - name: Deploy using stored timestamp run: echo "Deploying at $BUILD_TIME"
steps:
- name: Store build timestamp
run: echo "BUILD_TIME=$(date +'%T')" >> $GITHUB_ENV
- name: Deploy using stored timestamp
run: echo "Deploying at $BUILD_TIME"
์ฐธ๊ณ ํญ๋ชฉ
PowerShell ๋ฒ์ 5.1 ์ดํ(shell: powershell
)๋ ๊ธฐ๋ณธ์ ์ผ๋ก UTF-8์ ์ฌ์ฉํ์ง ์์ผ๋ฏ๋ก UTF-8 ์ธ์ฝ๋ฉ์ ์ง์ ํด์ผ ํฉ๋๋ค. ์์:
jobs: legacy-powershell-example: runs-on: windows-latest steps: - shell: powershell run: | "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
jobs:
legacy-powershell-example:
runs-on: windows-latest
steps:
- shell: powershell
run: |
"mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
PowerShell Core ๋ฒ์ 6 ์ด์(shell: pwsh
)์ ๊ธฐ๋ณธ์ ์ผ๋ก UTF-8์ ์ฌ์ฉํฉ๋๋ค. ์์:
jobs: powershell-core-example: runs-on: windows-latest steps: - shell: pwsh run: | "mypath" >> $env:GITHUB_PATH
jobs:
powershell-core-example:
runs-on: windows-latest
steps:
- shell: pwsh
run: |
"mypath" >> $env:GITHUB_PATH
ํ๊ฒฝ ๋ณ์ ์ค์
์ฐธ๊ณ ํญ๋ชฉ
๋ฌธ์ ๋ฅผ ๋ฐฉ์งํ๋ ค๋ฉด ์ฌ์ฉ ์ค์ธ ์ด์ ์ฒด์ ๋ฐ ์ ธ์ ๋์๊ณผ ๊ด๊ณ์์ด ํ๊ฒฝ ๋ณ์๋ฅผ ๋/์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
echo "{environment_variable_name}={value}" >> "$GITHUB_ENV"
echo "{environment_variable_name}={value}" >> "$GITHUB_ENV"
-
PowerShell ๋ฒ์ 6 ์ด์ ์ฌ์ฉ:
PowerShell "{environment_variable_name}={value}" >> $env:GITHUB_ENV
"{environment_variable_name}={value}" >> $env:GITHUB_ENV
-
PowerShell ๋ฒ์ 5.1 ์ดํ ์ฌ์ฉ:
PowerShell "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
ํ๊ฒฝ ๋ณ์๋ฅผ ์ ์ํ๊ฑฐ๋ ์
๋ฐ์ดํธํ๊ณ ์ด๋ฅผ GITHUB_ENV
ํ๊ฒฝ ํ์ผ์ ์์ฑํ์ฌ ์ํฌํ๋ก ์์
์ ํ์ ๋จ๊ณ์์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ ์ ์๋๋ก ํ ์ ์์ต๋๋ค. ํ๊ฒฝ ๋ณ์๋ฅผ ๋ง๋ค๊ฑฐ๋ ์
๋ฐ์ดํธํ๋ ๋จ๊ณ๋ ์ ๊ฐ์ ์ก์ธ์คํ ์ ์์ง๋ง ์์
์ ๋ชจ๋ ํ์ ๋จ๊ณ์๋ ์ก์ธ์ค ๊ถํ์ด ์์ต๋๋ค.
GITHUB_*
๋ฐ RUNNER_*
(์ผ)๋ก ๋ช
๋ช
๋ ๊ธฐ๋ณธ ํ๊ฒฝ ๋ณ์์ ๊ฐ์ ๋ฎ์ด์ธ ์ ์์ต๋๋ค. ํ์ฌ CI
๋ณ์ ๊ฐ์ ๋ฎ์ด์ธ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋, ์ด๊ฒ์ด ํญ์ ๊ฐ๋ฅํ ๊ฒ์ด๋ผ๊ณ ๋ณด์ฅ๋์ง๋ ์์ต๋๋ค. ๊ธฐ๋ณธ ํ๊ฒฝ ๋ณ์์ ๋ํ ์์ธํ ๋ด์ฉ์ ๋ณ์์ ์ ๋ณด ์ ์ฅ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์ฐธ๊ณ ํญ๋ชฉ
๋ณด์ ์ ํ์ผ๋ก ์ธํด GITHUB_ENV
๋ NODE_OPTIONS
ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ๋ ๋ฐ ์ฌ์ฉํ ์ ์์ต๋๋ค.
ํ๊ฒฝ ๋ณ์๋ฅผ GITHUB_ENV
์ ์ฐ๋ ์์
steps: - name: Set the value id: step_one run: | echo "action_state=yellow" >> "$GITHUB_ENV" - name: Use the value id: step_two run: | printf '%s\n' "$action_state" # This will output 'yellow'
steps:
- name: Set the value
id: step_one
run: |
echo "action_state=yellow" >> "$GITHUB_ENV"
- name: Use the value
id: step_two
run: |
printf '%s\n' "$action_state" # This will output 'yellow'
steps: - name: Set the value id: step_one run: | "action_state=yellow" >> $env:GITHUB_ENV - name: Use the value id: step_two run: | Write-Output "$env:action_state" # This will output 'yellow'
steps:
- name: Set the value
id: step_one
run: |
"action_state=yellow" >> $env:GITHUB_ENV
- name: Use the value
id: step_two
run: |
Write-Output "$env:action_state" # This will output 'yellow'
๋ค์ค ์ ๋ฌธ์์ด
๋ค์ค ์ ๋ฌธ์์ด์ ๊ฒฝ์ฐ ๋ค์ ๊ตฌ๋ฌธ์ ๊ตฌ๋ถ ๊ธฐํธ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
{name}<<{delimiter} {value} {delimiter}
{name}<<{delimiter}
{value}
{delimiter}
๊ฒฝ๊ณ
์ฌ์ฉ ์ค์ธ ๊ตฌ๋ถ ๊ธฐํธ๊ฐ ๊ฐ ๋ด์ ์์ฒด ์ค์์ ๋ฐ์ํ์ง ์๋๋ก ํฉ๋๋ค. ๊ฐ์ด ์์ ํ ์์์ธ ๊ฒฝ์ฐ ์ด ํ์์ ์ฌ์ฉํ๋ฉด ์ ๋ฉ๋๋ค. ๋์ ํ์ผ์ ๊ฐ์ ์๋๋ค.
์ฌ๋ฌ ์ค ๋ฌธ์์ด์ ์์
์ด ์์์์๋ EOF
์(๋ฅผ) ๊ตฌ๋ถ ๊ธฐํธ๋ก ์ฌ์ฉํ๊ณ JSON_RESPONSE
ํ๊ฒฝ ๋ณ์๋ฅผ curl
์๋ต์ ๊ฐ์ผ๋ก ์ค์ ํฉ๋๋ค.
steps: - name: Set the value in bash id: step_one run: | { echo 'JSON_RESPONSE<<EOF' curl https://example.com echo EOF } >> "$GITHUB_ENV"
steps:
- name: Set the value in bash
id: step_one
run: |
{
echo 'JSON_RESPONSE<<EOF'
curl https://example.com
echo EOF
} >> "$GITHUB_ENV"
steps: - name: Set the value in pwsh id: step_one run: | $EOF = (New-Guid).Guid "JSON_RESPONSE<<$EOF" >> $env:GITHUB_ENV (Invoke-WebRequest -Uri "https://example.com").Content >> $env:GITHUB_ENV "$EOF" >> $env:GITHUB_ENV shell: pwsh
steps:
- name: Set the value in pwsh
id: step_one
run: |
$EOF = (New-Guid).Guid
"JSON_RESPONSE<<$EOF" >> $env:GITHUB_ENV
(Invoke-WebRequest -Uri "https://example.com").Content >> $env:GITHUB_ENV
"$EOF" >> $env:GITHUB_ENV
shell: pwsh
์ถ๋ ฅ ๋งค๊ฐ ๋ณ์ ์ค์
๋จ๊ณ์ ์ถ๋ ฅ ๋งค๊ฐ ๋ณ์๋ฅผ ์ค์ ํฉ๋๋ค. ๋์ค์ ์ถ๋ ฅ ๊ฐ์ ๊ฒ์ํ๋ ค๋ฉด ๋จ๊ณ์๋ ์ ์๋ id
์ด(๊ฐ) ํ์ํฉ๋๋ค. ์ฌ๋ฌ ์ค ๋ฌธ์์ด ์น์
์์ ์ฌ์ฉ๋๋ ๊ฒ๊ณผ ๋์ผํ ๊ธฐ์ ๋ก ์ฌ๋ฌ ์ค ์ถ๋ ฅ ๊ฐ์ ์ค์ ํ์ฌ ์ฌ๋ฌ ์ค ํ๊ฒฝ ๋ณ์๋ฅผ ์ ์ํ ์ ์์ต๋๋ค.
echo "{name}={value}" >> "$GITHUB_OUTPUT"
echo "{name}={value}" >> "$GITHUB_OUTPUT"
"{name}=value" >> $env:GITHUB_OUTPUT
"{name}=value" >> $env:GITHUB_OUTPUT
์ถ๋ ฅ ๋งค๊ฐ ๋ณ์ ์ค์ ํ๊ธฐ ์์
์ด ์์์์๋ SELECTED_COLOR
์ถ๋ ฅ ๋งค๊ฐ ๋ณ์๋ฅผ ์ค์ ํ๊ณ ๋์ค์ ๊ฒ์ํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ ์ค๋๋ค.
- name: Set color id: color-selector run: echo "SELECTED_COLOR=green" >> "$GITHUB_OUTPUT" - name: Get color env: SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }} run: echo "The selected color is $SELECTED_COLOR"
- name: Set color
id: color-selector
run: echo "SELECTED_COLOR=green" >> "$GITHUB_OUTPUT"
- name: Get color
env:
SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }}
run: echo "The selected color is $SELECTED_COLOR"
์ด ์์์์๋ SELECTED_COLOR
์ถ๋ ฅ ๋งค๊ฐ ๋ณ์๋ฅผ ์ค์ ํ๊ณ ๋์ค์ ๊ฒ์ํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ ์ค๋๋ค.
- name: Set color id: color-selector run: | "SELECTED_COLOR=green" >> $env:GITHUB_OUTPUT - name: Get color env: SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }} run: Write-Output "The selected color is $env:SELECTED_COLOR"
- name: Set color
id: color-selector
run: |
"SELECTED_COLOR=green" >> $env:GITHUB_OUTPUT
- name: Get color
env:
SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }}
run: Write-Output "The selected color is $env:SELECTED_COLOR"
์์ ์์ฝ ์ถ๊ฐ
echo "{markdown content}" >> $GITHUB_STEP_SUMMARY
echo "{markdown content}" >> $GITHUB_STEP_SUMMARY
"{markdown content}" >> $env:GITHUB_STEP_SUMMARY
"{markdown content}" >> $env:GITHUB_STEP_SUMMARY
์ํฌํ๋ก ์คํ์ ์์ฝ ํ์ด์ง์ ํ์๋๋๋ก ๊ฐ ์์ ์ ๋ํด ๋ช ๊ฐ์ง ์ฌ์ฉ์ ์ง์ Markdown์ ์ค์ ํ ์ ์์ต๋๋ค. ์์ ์์ฝ์ ์ฌ์ฉํ์ฌ ํ ์คํธ ๊ฒฐ๊ณผ ์์ฝ๊ณผ ๊ฐ์ ๊ณ ์ ํ ์ฝํ ์ธ ๋ฅผ ํ์ํ๊ณ ๊ทธ๋ฃนํํ ์ ์์ผ๋ฏ๋ก ์ํฌํ๋ก ์คํ ๊ฒฐ๊ณผ๋ฅผ ๋ณด๋ ์ฌ์ฉ์๊ฐ ๋ก๊ทธ๋ก ์ด๋ํ์ฌ ์คํ๊ณผ ๊ด๋ จ๋ ์ค์ํ ์ ๋ณด(์: ์คํจ)๋ฅผ ํ์ธํ ํ์๊ฐ ์์ต๋๋ค.
์์
์์ฝ์ GitHub Flavored Markdown์ ์ง์ํ๋ฉฐ, ๋จ๊ณ๋ณ Markdown ์ฝํ
์ธ ๋ฅผ GITHUB_STEP_SUMMARY
ํ๊ฒฝ ํ์ผ์ ์ถ๊ฐํ ์ ์์ต๋๋ค. GITHUB_STEP_SUMMARY
๋ ์์
์ ๊ฐ ๋จ๊ณ์ ๋ํด ๊ณ ์ ํฉ๋๋ค. GITHUB_STEP_SUMMARY
๊ฐ ์ฐธ์กฐํ๋ ๋จ๊ณ๋ณ ํ์ผ์ ๋ํ ์์ธํ ๋ด์ฉ์ ํ๊ฒฝ ํ์ผ์ ์ฐธ์กฐํ์ธ์.
์์ ์ด ์๋ฃ๋๋ฉด ์์ ์ ๋ชจ๋ ๋จ๊ณ์ ๋ํ ์์ฝ์ด ๋จ์ผ ์์ ์์ฝ์ผ๋ก ๊ทธ๋ฃนํ๋๊ณ ์ํฌํ๋ก ์คํ ์์ฝ ํ์ด์ง์ ํ์๋ฉ๋๋ค. ์ฌ๋ฌ ์์ ์ด ์์ฝ์ ์์ฑํ๋ ๊ฒฝ์ฐ ์์ ์์ฝ์ ์์ ์๋ฃ ์๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ๋ฉ๋๋ค.
์์ ์์ฝ ์ถ๊ฐํ๊ธฐ ์์
echo "### Hello world! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "### Hello world! :rocket:" >> $GITHUB_STEP_SUMMARY
"### Hello world! :rocket:" >> $env:GITHUB_STEP_SUMMARY
"### Hello world! :rocket:" >> $env:GITHUB_STEP_SUMMARY
์ฌ๋ฌ ์ค Markdown ์ฝํ ์ธ
์ฌ๋ฌ ์ค Markdown ์ฝํ
์ธ ์ ๊ฒฝ์ฐ >>
๋ฅผ ์ฌ์ฉํ์ฌ ํ์ฌ ๋จ๊ณ์ ๋ํ ์ฝํ
์ธ ๋ฅผ ์ง์์ ์ผ๋ก ์ถ๊ฐํ ์ ์์ต๋๋ค. ์ถ๊ฐ ์์
๋ง๋ค ์ค ๋ฐ๊ฟ ๋ฌธ์๊ฐ ์๋์ผ๋ก ์ถ๊ฐ๋ฉ๋๋ค.
์ฌ๋ฌ ์ค Markdown ์ฝํ ์ธ ์ ์์
- name: Generate list using Markdown
run: |
echo "This is the lead in sentence for the list" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
echo "- Lets add a bullet point" >> $GITHUB_STEP_SUMMARY
echo "- Lets add a second bullet point" >> $GITHUB_STEP_SUMMARY
echo "- How about a third one?" >> $GITHUB_STEP_SUMMARY
- name: Generate list using Markdown
run: |
"This is the lead in sentence for the list" >> $env:GITHUB_STEP_SUMMARY
"" >> $env:GITHUB_STEP_SUMMARY # this is a blank line
"- Lets add a bullet point" >> $env:GITHUB_STEP_SUMMARY
"- Lets add a second bullet point" >> $env:GITHUB_STEP_SUMMARY
"- How about a third one?" >> $env:GITHUB_STEP_SUMMARY
์์ ์์ฝ ๋ฎ์ด์ฐ๊ธฐ
ํ์ฌ ๋จ๊ณ์ ๋ชจ๋ ์ฝํ
์ธ ๋ฅผ ์ง์ฐ๋ ค๋ฉด >
์(๋ฅผ) ์ฌ์ฉํ์ฌ Bash์์ ์ด์ ์ ์ถ๊ฐํ ์ฝํ
์ธ ๋ฅผ ๋ฎ์ด์ฐ๊ฑฐ๋ PowerShell์ -Append
์(๋ฅผ) ์ญ์ ํ ์ ์์ต๋๋ค.
์์ ์์ฝ ๋ฎ์ด์ฐ๊ธฐ ์์
- name: Overwrite Markdown
run: |
echo "Adding some Markdown content" >> $GITHUB_STEP_SUMMARY
echo "There was an error, we need to clear the previous Markdown with some new content." > $GITHUB_STEP_SUMMARY
- name: Overwrite Markdown
run: |
"Adding some Markdown content" >> $env:GITHUB_STEP_SUMMARY
"There was an error, we need to clear the previous Markdown with some new content." >> $env:GITHUB_STEP_SUMMARY
์์ ์์ฝ ์ ๊ฑฐ
ํ์ฌ ๋จ๊ณ์ ๋ํ ์์ฝ์ ์์ ํ ์ ๊ฑฐํ๋ ค๋ฉด GITHUB_STEP_SUMMARY
๊ฐ ์ฐธ์กฐํ๋ ํ์ผ์ ์ญ์ ํ ์ ์์ต๋๋ค.
์์ ์์ฝ ์ ๊ฑฐํ๊ธฐ ์์
- name: Delete all summary content
run: |
echo "Adding Markdown content that we want to remove before the step ends" >> $GITHUB_STEP_SUMMARY
rm $GITHUB_STEP_SUMMARY
- name: Delete all summary content
run: |
"Adding Markdown content that we want to remove before the step ends" >> $env:GITHUB_STEP_SUMMARY
Remove-Item $env:GITHUB_STEP_SUMMARY
๋จ๊ณ๊ฐ ์๋ฃ๋๋ฉด ์์ ์์ฝ์ด ์ ๋ก๋๋๊ณ ํ์ ๋จ๊ณ์์ ์ด์ ์ ์ ๋ก๋ํ Markdown ์ฝํ ์ธ ๋ฅผ ์์ ํ ์ ์์ต๋๋ค. ์์ฝ์์๋ ์ค์๋ก ์ถ๊ฐ๋์์ ์ ์๋ ๋ชจ๋ ๋น๋ฐ์ด ์๋์ผ๋ก ๋ง์คํน๋ฉ๋๋ค. ์์ ์์ฝ์ ์ญ์ ํด์ผ ํ๋ ์ค์ํ ์ ๋ณด๊ฐ ํฌํจ๋ ๊ฒฝ์ฐ ์ ์ฒด ์ํฌํ๋ก ์คํ์ ์ญ์ ํ์ฌ ๋ชจ๋ ์์ ์์ฝ์ ์ ๊ฑฐํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ์ํฌํ๋ก ์คํ ์ญ์ ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
๋จ๊ณ ๊ฒฉ๋ฆฌ ๋ฐ ํ๋
์์ ์์ฝ์ ๋จ๊ณ ๊ฐ์ ๊ฒฉ๋ฆฌ๋๋ฉฐ ๊ฐ ๋จ๊ณ๋ ์ต๋ 1MiB ํฌ๊ธฐ๋ก ์ ํ๋ฉ๋๋ค. ๋จ์ผ ๋จ๊ณ์ ์ ์ฌ์ ์ผ๋ก ์๋ชป๋ ํ์์ Markdown์ด ํ์ ๋จ๊ณ์ ๋ํ Markdown ๋ ๋๋ง์ ์ค๋จ์ํฌ ์ ์๋๋ก ๋จ๊ณ ๊ฐ์ ๊ฒฉ๋ฆฌ๊ฐ ์ ์ฉ๋ฉ๋๋ค. ํ ๋จ๊ณ์ 1MiB ์ด์์ ์ฝํ ์ธ ๊ฐ ์ถ๊ฐ๋๋ฉด ํด๋น ๋จ๊ณ์ ์ ๋ก๋๊ฐ ์คํจํ๊ณ ์ค๋ฅ ์ฃผ์์ด ์์ฑ๋ฉ๋๋ค. ์์ ์์ฝ ์ ๋ก๋ ์ค๋ฅ๋ ๋จ๊ณ ๋๋ ์์ ์ ์ ์ฒด ์ํ์ ์ํฅ์ ๋ฏธ์น์ง ์์ต๋๋ค. ์์ ๋ณ๋ก ๋จ๊ณ์ ์์ ์์ฝ์ด ์ต๋ 20๊ฐ ํ์๋ฉ๋๋ค.
์์คํ ๊ฒฝ๋ก ์ถ๊ฐ
๋๋ ํฐ๋ฆฌ๋ฅผ ์์คํ
PATH
๋ณ์ ์์ ์ถ๊ฐํ๊ณ ํ์ฌ ์์
์ ๋ชจ๋ ํ์ ์์
์ ์ฌ์ฉํ ์ ์๋๋ก ์๋์ผ๋ก ์ค์ ํฉ๋๋ค. ํ์ฌ ์คํ ์ค์ธ ์์
์ ์
๋ฐ์ดํธ๋ ๊ฒฝ๋ก ๋ณ์์ ์ก์ธ์คํ ์ ์์ต๋๋ค. ์์
์ ๋ํด ํ์ฌ ์ ์๋ ๊ฒฝ๋ก๋ฅผ ๋ณด๋ ค๋ฉด ๋จ๊ณ ๋๋ ์์
์์ echo "$PATH"
๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์์คํ ๊ฒฝ๋ก ์ถ๊ฐํ๊ธฐ ์์
์ด ์์ ์์๋ ์ฌ์ฉ์ $HOME/.local/bin
๋๋ ํฐ๋ฆฌ๋ฅผ PATH
์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ ์ค๋๋ค.
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
์ด ์์ ์์๋ ์ฌ์ฉ์ $env:HOMEPATH/.local/bin
๋๋ ํฐ๋ฆฌ๋ฅผ PATH
์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ ์ค๋๋ค.
"$env:HOMEPATH/.local/bin" | Out-File -FilePath "$env:GITHUB_PATH" -Append
"$env:HOMEPATH/.local/bin" | Out-File -FilePath "$env:GITHUB_PATH" -Append