Skip to content

Commit

Permalink
fix: update automated syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Aug 21, 2023
1 parent 11fb652 commit de581dd
Showing 1 changed file with 44 additions and 80 deletions.
124 changes: 44 additions & 80 deletions src/commands/fs/automated.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,18 @@ const path = require("path")

function globUpdater(er, files) {

if (er)
console.log(files, 'glob resolving issue')
else
files.forEach(filename => {

console.log(filename + '/automated.yml', 'glob resolving issue')
update(filename + '/automated.yml')
})

if (er)
console.log(files, 'glob resolving issue')
else
files.forEach(filename => {
update(filename + '/automated.yml')
})
console.log('Completed')
}




function update(YmlPath) {
let name = path.basename(path.resolve(path.dirname(YmlPath), '../..')).substring(9);
let fileContent = `name: Automated Workflow
'on':
let fileContent = `name: Automated Workflow
on:
push:
branches:
- master
Expand All @@ -31,111 +25,81 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup nodejs
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Jaid/action-sync-node-meta
uses: jaid/action-sync-node-meta@v1.4.0
with:
direction: overwrite-github
githubToken: '\${{ secrets.GITHUB }}'
githubToken: "\${{ secrets.GITHUB }}"
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup nodejs
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 14
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/npm
@semantic-release/git
@semantic-release/github
env:
GITHUB_TOKEN: '\${{ secrets.GITHUB_TOKEN }}'
NPM_TOKEN: '\${{ secrets.NPM_TOKEN }}'
GITHUB_TOKEN: "\${{ secrets.GITHUB }}"
NPM_TOKEN: "\${{ secrets.NPM_TOKEN }}"
outputs:
new_release_published: '\${{ steps.semantic.outputs.new_release_published }}'
new_release_version: '\${{ steps.semantic.outputs.new_release_version }}'
cdn:
new_release_published: "\${{ steps.semantic.outputs.new_release_published }}"
new_release_version: "\${{ steps.semantic.outputs.new_release_version }}"
upload:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.new_release_published == 'true'
env:
VERSION: '\${{ needs.release.outputs.new_release_version }}'
VERSION: "\${{ needs.release.outputs.new_release_version }}"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup nodejs
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: yarn install
run: >
echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" >
.npmrc
yarn install
- name: yarn build
- name: Set npm registry auth
run: echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- name: upload bundle as version
uses: CoCreate-app/CoCreate-s3@master
with:
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
bucket: testcrudbucket
source: ./dist
destination: '/${name}/\${{env.VERSION}}'
acl: public-read
- name: upload bundle as latest
uses: CoCreate-app/CoCreate-s3@master
with:
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
bucket: testcrudbucket
source: ./dist
destination: /${name}/latest
acl: public-read
invalidations: true
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup nodejs
uses: actions/setup-node@v3
with:
node-version: 16
- name: update documentation
uses: CoCreate-app/CoCreate-docs@master
- name: Set Environment Variables
run: |
echo "organization_id=\${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
echo "key=\${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
echo "host=\${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
- name: CoCreate Upload
run: coc upload
`;
// process.exit()
if (fs.existsSync(YmlPath))
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, fileContent)
// process.exit()
if (fs.existsSync(YmlPath))
fs.unlinkSync(YmlPath)
fs.writeFileSync(YmlPath, fileContent)

}



// glob("../CoCreate-components/CoCreate-action/.github/workflows", globUpdater)
glob("../CoCreate-components/*/.github/workflows/", globUpdater)
glob("../CoCreate-apps/*/.github/workflows/", globUpdater)
glob("../CoCreate-plugins/*/.github/workflows/", globUpdater)

// substrin (9) removes CoCreateC leving namme as SS
// glob("../CoCreateCSS/.github/workflows/", globUpdater)

// does not need to add name... will require for name to be removed from destination
// glob("../CoCreateJS/.github/workflows/", globUpdater)
// glob("/home/cocreate/CoCreate/CoCreate-components/CoCreate-actions/.github/workflows", globUpdater)
glob("/home/cocreate/CoCreate/CoCreate-components/*/.github/workflows/", globUpdater)
glob("/home/cocreate/CoCreate/CoCreate-apps/*/.github/workflows/", globUpdater)
glob("/home/cocreate/CoCreate/CoCreate-plugins/*/.github/workflows/", globUpdater)

console.log('finished')
glob("/home/cocreate/CoCreate/CoCreate-admin/.github/workflows/", globUpdater)
glob("/home/cocreate/CoCreate/CoCreateCSS/.github/workflows/", globUpdater)
glob("/home/cocreate/CoCreate/CoCreateJS/.github/workflows/", globUpdater)
glob("/home/cocreate/CoCreate/CoCreate-wesite/.github/workflows/", globUpdater)

0 comments on commit de581dd

Please sign in to comment.