From 8e172a2114ba3ef0e81ea07f467a6ce885d87d47 Mon Sep 17 00:00:00 2001 From: Sthope Date: Mon, 28 Aug 2023 18:45:27 +0200 Subject: [PATCH] Update .drone.yml --- .drone.yml | 56 ++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4803f15..dbc16db 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,33 +1,27 @@ -kind: pipeline -name: release - steps: - - name: run-script - image: node:14 - environment: - TARGET_RELEASE_TAG: '2023-02-13-1223' + - name: create-script-file + image: alpine:3.13 commands: - - | - echo "const axios = require('axios');" > custom-script.js - echo "" >> custom-script.js - echo "function getLatestReleaseTag() {" >> custom-script.js - echo " return axios" >> custom-script.js - echo " .get('https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest')" >> custom-script.js - echo " .then((response) => response.data.tag_name)" >> custom-script.js - echo " .catch((error) => {" >> custom-script.js - echo " console.error('Error fetching latest release tag:', error.message);" >> custom-script.js - echo " return '0.0.0';" >> custom-script.js - echo " });" >> custom-script.js - echo "}" >> custom-script.js - echo "" >> custom-script.js - echo "getLatestReleaseTag().then((latestReleaseTag) => {" >> custom-script.js - echo " const targetReleaseTag = process.env.TARGET_RELEASE_TAG;" >> 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 - echo " } else if (latestReleaseTag === targetReleaseTag) {" >> custom-script.js - echo " console.log('The release tag is the same as the target tag.');" >> custom-script.js - echo " } else {" >> custom-script.js - echo " console.log('The new release is older than the one I have.');" >> custom-script.js - echo "}" >> custom-script.js - echo "" >> custom-script.js + - echo "const axios = require('axios');" > custom-script.js + - echo "" >> custom-script.js + - echo "function getLatestReleaseTag() {" >> custom-script.js + - echo " return axios" >> custom-script.js + - echo " .get('https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest')" >> custom-script.js + - echo " .then((response) => response.data.tag_name)" >> custom-script.js + - echo " .catch((error) => {" >> custom-script.js + - echo " console.error('Error fetching latest release tag:', error.message);" >> custom-script.js + - echo " return '0.0.0';" >> custom-script.js + - echo " });" >> custom-script.js + - echo "}" >> custom-script.js + - echo "" >> custom-script.js + - echo "getLatestReleaseTag().then((latestReleaseTag) => {" >> custom-script.js + - echo " const targetReleaseTag = process.env.TARGET_RELEASE_TAG;" >> 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 + - echo " } else if (latestReleaseTag === targetReleaseTag) {" >> custom-script.js + - echo " console.log('The release tag is the same as the target tag.');" >> custom-script.js + - echo " } else {" >> custom-script.js + - echo " console.log('The new release is older than the one I have.');" >> custom-script.js + - echo "}" >> custom-script.js + - echo "" >> custom-script.js