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

This commit is contained in:
Sthope 2023-08-28 18:38:06 +02:00
parent df775d6a3c
commit 014ad124c3

View File

@ -2,34 +2,37 @@ kind: pipeline
name: release name: release
steps: steps:
- name: run - name: create-script-file
image: node:14 image: alpine:3.13
commands: commands:
- | - echo "const axios = require('axios');" > script.js
const axios = require("axios"); - echo "" >> script.js
- echo "function getLatestReleaseTag() {" >> script.js
function getLatestReleaseTag() { - echo " const repoOwner = 'insignia-live';" >> script.js
const repoOwner = "insignia-live"; - echo " const repoName = 'setup-assistant-release';" >> script.js
const repoName = "setup-assistant-release"; - echo "" >> script.js
- echo " return axios" >> script.js
return axios - echo " .get(\`https://api.github.com/repos/\${repoOwner}/\${repoName}/releases/latest\`)" >> script.js
.get(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`) - echo " .then((response) => response.data.tag_name)" >> script.js
.then((response) => response.data.tag_name) - echo " .catch((error) => {" >> script.js
.catch((error) => { - echo " console.error('Error fetching latest release tag:', error.message);" >> script.js
console.error("Error fetching latest release tag:", error.message); - echo " return '0.0.0';" >> script.js
return "0.0.0"; // Return a default value in case of an error - echo " });" >> script.js
}); - echo "}" >> script.js
} - echo "" >> script.js
- echo "getLatestReleaseTag().then((latestReleaseTag) => {" >> script.js
getLatestReleaseTag().then((latestReleaseTag) => { - echo " const targetReleaseTag = '2023-02-13-1223';" >> script.js
const targetReleaseTag = "2023-02-13-1223"; - echo "" >> script.js
- echo " if (latestReleaseTag > targetReleaseTag) {" >> script.js
if (latestReleaseTag > targetReleaseTag) { - echo " console.log('This pipeline is run because the new release is newer than the one I have.');" >> script.js
console.log("This pipeline is run because the new release is newer than the one I have."); - echo " } else if (latestReleaseTag === targetReleaseTag) {" >> script.js
} else if (latestReleaseTag === targetReleaseTag) { - echo " console.log('The release tag is the same as the target tag.');" >> script.js
console.log("The release tag is the same as the target tag."); - echo " } else {" >> script.js
} else { - echo " console.log('The new release is older than the one I have.');" >> script.js
console.log("The new release is older than the one I have."); - echo "}" >> script.js
} - echo "" >> script.js
});
- name: run
image: node:14
commands:
- node script.js