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

This commit is contained in:
Sthope 2023-08-28 18:41:14 +02:00
parent ac8efa2f52
commit 613dafa204

View File

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