Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Sthope 2023-08-28 19:03:34 +02:00
parent 20732b23d9
commit 0d5778d6a7

View File

@ -5,31 +5,37 @@ steps:
- name: create-script-file - name: create-script-file
image: alpine:3.13 image: alpine:3.13
commands: commands:
- echo "const axios = require('axios');" > custom-script.js - cat <<EOF > script.js
- echo "" >> custom-script.js const axios = require('axios');
- echo "function getLatestReleaseTag() {" >> custom-script.js
- echo " return axios" >> custom-script.js function getLatestReleaseTag() {
- echo " .get('https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest')" >> custom-script.js const repoOwner = process.env.REPO_OWNER;
- echo " .then((response) => response.data.tag_name)" >> custom-script.js const repoName = process.env.REPO_NAME;
- echo " .catch((error) => {" >> custom-script.js
- echo " console.error('Error fetching latest release tag:', error.message);" >> custom-script.js return axios
- echo " return '0.0.0';" >> custom-script.js .get(\`https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest\`)
- echo " });" >> custom-script.js .then((response) => response.data.tag_name)
- echo "}" >> custom-script.js .catch((error) => {
- echo "" >> custom-script.js console.error('Error fetching latest release tag:', error.message);
- echo "getLatestReleaseTag().then((latestReleaseTag) => {" >> custom-script.js return '0.0.0';
- echo " const targetReleaseTag = '2023-02-13-1223';" >> custom-script.js });
- echo "" >> custom-script.js }
- echo " if (latestReleaseTag > targetReleaseTag) {" >> custom-script.js
- echo " console.log('This pipeline is run because the new release is newer than the one I have.');" >> custom-script.js getLatestReleaseTag().then((latestReleaseTag) => {
- echo " } else if (latestReleaseTag === targetReleaseTag) {" >> custom-script.js const targetReleaseTag = '2023-02-13-1223';
- echo " console.log('The release tag is the same as the target tag.');" >> custom-script.js
- echo " } else {" >> custom-script.js if (latestReleaseTag > targetReleaseTag) {
- echo " console.log('The new release is older than the one I have.');" >> custom-script.js console.log('This pipeline is run because the new release is newer than the one I have.');
- echo "}" >> custom-script.js } else if (latestReleaseTag === targetReleaseTag) {
- echo "" >> custom-script.js console.log('The release tag is the same as the target tag.');
} else {
console.log('The new release is older than the one I have.');
}
});
EOF
- chmod +x script.js
- name: run - name: run
image: node:14 image: node:14
commands: commands:
- node custom-script.js - node script.js