π₯οΈ λ°±μλ/CICD
[CICD] κΉν λ ν¬ μμ± μλν
OR15A
2024. 3. 23. 00:51
3. κ°λ¨ν μν¬νλ‘μ° λ§λ€κΈ°
κΉν λ ν¬ μμ± μλν
name: create-repo
on:
workflow_dispatch:
inputs:
prefix:
description: 'set repo prefix'
required: true
default: 'service'
type: choice
options:
- example
- service
name:
description: 'set repo name'
required: true
default: 'github-actions'
type: string
jobs:
create-repo-automation:
runs-on: ubuntu-latest
steps:
- name: gh auth login
run: |
echo ${{ secrets.PERSONAL_ACCESS_TOKEN }} | gh auth login --with-token
- name: create-repo
id: create-repo
run: |
gh repo create sangwon-action/${{ inputs.prefix }}-${{ inputs.name }} --public --add-readme
- name: slack
if: always()
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"attachments": [
{
"pretext": "create repo result",
"color": "28a745",
"fields": [
{
"title": "create repo result ${{ steps.create-repo.outcome }}",
"short": true,
"value": "${{ inputs.prefix }}-${{ inputs.name }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- λ ν¬μ§ν 리 ν ν°, μ¬λ μΉλΆ urlκ°μ secret μΌλ‘ μ μ₯ν΄μ μ¬μ©ν¨
- λ ν¬ μμ± μ gh cli (github cli) μ¬μ©ν¨
- gh cli : ν°λ―Έλμμ github κΈ°λ₯μ 컀맨λλ‘ μ μ΄ κ°λ₯ν¨
- λ ν¬μ§ν 리, μ΄μ, ν 리νμ€νΈ, κΉν μ‘μ λ± κ΄λ¦¬
- κΉν λ¬λμμ κΈ°λ³Έμ μΌλ‘ μ¬μ© κ°λ₯ν¨
- if: always() μ¬μ©νλ©΄ 첫λ²μ§Έ stepμ΄ μ€ν¨νλλΌλ λλ²μ§Έ stepμ κ°μ λ‘ μ€νν μ μμ