GitHub Actions (멋쟁이 사자처럼 연합세션)
7337 단어 LIKELION멋사github actionsLIKELION
GitHub Actions란?
- GitHub에서 제공하는 CI(Continuous Integration) 툴로, GitHub Repository를 기반으로 함께 작동하는 소프트웨어 개발 Workflow 자동화도구!
(Workflow를 파이프라인화 시켜서 차례차례 진행한다고 생각하면 된다.)
GitHub Actions 사용법
직접 커스텀하여 Action 제작하기
(Workflow를 파이프라인화 시켜서 차례차례 진행한다고 생각하면 된다.)
- Docker container actions
- Javascript actions
이미 만들어진 Action 사용하기
- GitHub Marketplace (오늘은 이걸 이용한다!)
GitHub Actions 파일 형식
GitHub Actions Workflow 구조
오늘의 Hands-on Lab Session
1. GitHub Actions로 Discord에 GitHub 활동 알림 전송하기
- GitHub Actions 시작하기 / Marketplace Action 활용 + Discord 연동하기
2. 쉽고 빠르게 디스코드 라이브러리 가져다 쓰기
- 디스코드 라이브러리 활용 + 봇 사용
⛺️ Repository 만들기
- License(MIT License)와 README를 체크하고 Repository를 만들어준다.
⛺️ GitHub 웹 에디터 이용하기
- Repository 내의 파일을 클릭하고
.
을 누르면 깃헙 웹 에디터로 이동함 - (원격에서 온라인으로 코드 작성 가능 - 웹으로 하는 VS Code)
- 커밋 푸시 풀 모두 가능 (맨아래 싱크 버튼으로 맞춰줄수도 있음)
⛺️ GitHub Actions Workflows
GitHub Actions Workflows
: 정해둔 이벤트가 실행되었을 때 깃헙 내부적으로 실행될 명령어들을 정해 놓는 작업Actions
->new workflow
->Set up this workflow
⛺️ yml(=yaml)
# This is a basic workflow to help you get started with Actions
name: Discord 알리미
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# pull_request:
# branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 # 지우면 안됨, 서버에서 클론받아 액션을 돌리고 checkout을 하는 과정이 필수적임
- name: 멋사 안녕
run: echo "멋사 안녕"
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: GitHub Actions
DISCORD_AVATAR: https://images.velog.io/images/nathan29849/post/344b519b-f338-45a9-8f24-75fe8f6253f5/image.png
uses: Ilshidur/action-discord@master
with:
args: "DOUGH GitHub Actions!: {{GITHUB_EVENT_NAME}}"
# args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed.'
# # Runs a single command using the runners shell
# - name: Run a one-line script
# run: echo Hello, world!
# # Runs a set of commands using the runners shell
# - name: Run a multi-line script
# run: |
# echo Add other actions to build,
# echo test, and deploy your project.
⛺️ Github Docs - Environment variables(추가사항)
-
위와 같이
Github docs
에서 Github Actions에 대한Environment variables
를 확인할 수 있고 이를yml
에서 이용할 수 있다. -
위의
yml
코드에서 아래에 해당하는 부분은 이Environment variables
에서 가져온 변수이다.
args: "DOUGH GitHub Actions!: {{GITHUB_EVENT_NAME}}"
- 이런 식으로 환경변수를 사용하여 다양한 Github Actions의 기능을 활용할 수 있다.
Author And Source
이 문제에 관하여(GitHub Actions (멋쟁이 사자처럼 연합세션)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@nathan29849/GitHub-Actions-멋쟁이-사자처럼-연합세션저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)