Update .drone.yml

This commit is contained in:
Sthope 2023-08-28 18:33:02 +02:00
parent 1219f9a47a
commit 7e3bb9ff69

View File

@ -2,16 +2,41 @@ kind: pipeline
name: release
trigger:
release: true
event:
- release
steps:
- name: checkout
image: plugins/git
settings:
repo: https://github.com/insignia-live/setup-assistant-release.git
- name: create-script-file
image: alpine:3.13
commands:
- echo "const axios = require('axios');" > script.js
- echo "" >> script.js
- echo "function getLatestReleaseTag() {" >> script.js
- echo " const repoOwner = 'insignia-live';" >> script.js
- echo " const repoName = 'setup-assistant-release';" >> script.js
- echo "" >> script.js
- echo " return axios" >> script.js
- echo " .get(\`https://api.github.com/repos/\${repoOwner}/\${repoName}/releases/latest\`)" >> script.js
- echo " .then((response) => response.data.tag_name)" >> script.js
- echo " .catch((error) => {" >> script.js
- echo " console.error('Error fetching latest release tag:', error.message);" >> script.js
- echo " return '0.0.0';" >> script.js
- echo " });" >> script.js
- echo "}" >> script.js
- echo "" >> script.js
- echo "getLatestReleaseTag().then((latestReleaseTag) => {" >> script.js
- echo " const targetReleaseTag = '2023-02-13-1223';" >> script.js
- echo "" >> script.js
- 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
- echo " } else if (latestReleaseTag === targetReleaseTag) {" >> script.js
- echo " console.log('The release tag is the same as the target tag.');" >> script.js
- echo " } else {" >> script.js
- echo " console.log('The new release is older than the one I have.');" >> script.js
- echo "}" >> script.js
- echo " " >> script.js
- name: run
image: node:14
commands:
- npm install axios
- node script.js