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

This commit is contained in:
Sthope 2023-08-28 18:40:26 +02:00
parent 41e94d2f1f
commit ac8efa2f52

View File

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