I have this script createmap.sh
in the public/scripts
folder. I need to run it on master deployment
the code in yaml file is
name: create-map
on: push
run: .public/script.sh
runs-on: ubuntu-latest
shell: bash
it is a simple script that is supposed to create a sitemap and ping google
# yarn sitemap
$ cd public
$ rm -rf sitemap
$ mkdir sitemap
$ cd ..
$ cd scripts
$ node ./sitemap-posts.js
$ node ./compress-map.js
$ node ./create-one-map.js
$ curl http://google.com/ping?sitemap=https://website.com/sitemap.xml
My folder structure is rootdirectory/scripts
and rootdirectory/public
When I deploy the scripts are not run and I don't know where the problem is
Run the bash script from an action using run: bash ${GITHUB_WORKSPACE}/scripts/example.sh my-folder-name and use $1 to use the argument you passed. This makes it easy to re-use a script from multiple actions.
Using bash or sh You must have git bash installed if you are using Windows. For Linux and macOS, bash is installed by default. In this method, we type bash followed by the file name with extension i.e. sh in this case. In a terminal, run the following code by replacing the filename with your bash script filename.
With GitHub Actions, you can trigger CI/CD workflows and pipelines of webhooks from these apps (even something simple, like a chat app message, if you've integrated your chat app into your GitHub repository, of course).
You need to add permission for execution:
jobs:
run_tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Run script file
run: |
chmod +x ./public/scripts/test.sh
./public/scripts/test.sh
shell: bash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With