Sync from https://github.com/vmactions/base-vm #273
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Step 2, Generate the project from BaseVM" | |
on: | |
schedule: | |
- cron: '10 1 * * *' | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'conf/*' | |
- '.github/data/*' | |
- '.github/workflows/generate.yml' | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.VM_TOKEN }} | |
- name: Get latest release | |
id: get-latest-release | |
uses: InsonusK/[email protected] | |
with: | |
myToken: ${{ github.token }} | |
view_top: 1 | |
- name: Using main branch | |
run: | | |
git switch main || (git fetch --all && git checkout -b main origin/main) | |
. conf/default.release.conf | |
echo "DEFAULT_RELEASE=$DEFAULT_RELEASE" >> $GITHUB_ENV | |
echo "ALL_RELEASES=\"$(ls conf/ | grep -v default | sed 's/.conf//g' | tr '\n' ',' | sed "s/,\$//" | sed 's/,/", "/g')\"" >> $GITHUB_ENV | |
git clone https://github.com/vmactions/base-vm.git | |
mkdir -p .github/tpl | |
cat base-vm/.github/tpl/README.tpl.md >.github/tpl/README.tpl.md | |
- name: Generate files | |
uses: vmactions/[email protected] | |
env: | |
LATEST_TAG: ${{ steps.get-latest-release.outputs.tag_name }} | |
with: | |
datafile: .github/data/datafile.ini | |
files: | | |
base-vm/.github/tpl/test.tpl.yml : .github/workflows/test.yml | |
base-vm/.github/tpl/manual.tpl.yml : .github/workflows/manual.yml | |
base-vm/.github/FUNDING.yml : .github/FUNDING.yml | |
base-vm/.github/workflows/readme.yml : .github/workflows/readme.yml | |
base-vm/.github/workflows/major.yml : .github/workflows/major.yml | |
base-vm/package.json : package.json | |
base-vm/index.js : index.js | |
base-vm/action.yml : action.yml | |
base-vm/run.sh : run.sh | |
- name: Update node_modules | |
run: | | |
[ -e "node_modules" ] && git rm -r node_modules | |
npm install --save | |
git add node_modules | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Generated from https://github.com/vmactions/base-vm" | |
pull: '--rebase --autostash ' | |
add: | | |
.github/workflows/readme.yml | |
.github/workflows/major.yml | |
.github/workflows/manual.yml | |
.github/workflows/test.yml | |
.github/tpl/README.tpl.md | |
.github/FUNDING.yml | |
package.json | |
package-lock.json | |
index.js | |
action.yml | |
run.sh | |
node_modules | |