Skip to content

Latest commit

 

History

History
 
 

088

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

How to Create Your Own GitHub Actions?

YouTube Tutorial

Content

  • Demo
  • Build JavaScript GitHub Action
  • Test JavaScript GitHub Action

Build JavaScript GitHub Action

  • Create GitHub repository increment-git-tag for JavaScript GitHub Action. Keep it public to allow other repositories to use this action. Also, add a README.md file, gitignore, and select MIT Licence.

  • Clone repository

git clone [email protected]:antonputra/increment-git-tag.git
  • Initialize the project and install dependencies
cd increment-git-tag
npm init -y
npm i @actions/core
npm i @actions/exec
  • Open Project
code .
  • Create action.yml

  • Create index.js

  • Install vercel/ncc

npm i -g @vercel/ncc
  • Compile JavaScript code into single file
ncc build index.js -o action
  • Create git_update.sh
  • Make git_update.sh executable
chmod +x chmod +x action/git_update.sh
  • Commit and push
git add .
git commit -m 'init commit'
git tag -a -m "increment git tag" v1
git push --follow-tags

Test JavaScript GitHub Action

  • Create GitHub repository lesson-088 (private)

  • Clone repo

git clone [email protected]:antonputra/lesson-088.git
  • Create .github/workflows/main.yaml (patch)

  • Commit and push

  • Increment major version, commit and push

Links