This commit is contained in:
parent
e9d82b52d6
commit
08e43b6a89
42
.drone.yml
42
.drone.yml
@ -1,41 +1,17 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: release
|
name: release
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
release: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: create-script-file
|
# - name: checkout
|
||||||
image: alpine:3.13
|
# image: plugins/git
|
||||||
commands:
|
# settings:
|
||||||
- cat <<EOF > script.js
|
# repo: https://github.com/insignia-live/setup-assistant-release.git
|
||||||
const axios = require('axios');
|
|
||||||
|
|
||||||
function getLatestReleaseTag() {
|
|
||||||
const repoOwner = process.env.REPO_OWNER;
|
|
||||||
const repoName = process.env.REPO_NAME;
|
|
||||||
|
|
||||||
return axios
|
|
||||||
.get(\`https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest\`)
|
|
||||||
.then((response) => response.data.tag_name)
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error fetching latest release tag:', error.message);
|
|
||||||
return '0.0.0';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestReleaseTag().then((latestReleaseTag) => {
|
|
||||||
const targetReleaseTag = '2023-02-13-1223';
|
|
||||||
|
|
||||||
if (latestReleaseTag > targetReleaseTag) {
|
|
||||||
console.log('This pipeline is run because the new release is newer than the one I have.');
|
|
||||||
} else if (latestReleaseTag === targetReleaseTag) {
|
|
||||||
console.log('The release tag is the same as the target tag.');
|
|
||||||
} else {
|
|
||||||
console.log('The new release is older than the one I have.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
EOF
|
|
||||||
- chmod +x script.js
|
|
||||||
|
|
||||||
- name: run
|
- name: run
|
||||||
image: node:14
|
image: node:14
|
||||||
commands:
|
commands:
|
||||||
- node script.js
|
- npm install axios
|
||||||
|
- node tools/script.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user