Skip to content

Commit

Permalink
all js
Browse files Browse the repository at this point in the history
  • Loading branch information
martinco committed Aug 24, 2023
1 parent 36a3ece commit f137d0c
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,59 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-tags: true

- name: Find Tag
id: tag
run: |
# Get our new version from existing git tags
NEW_VER="${DCS_BASE_VERSION}.$(git tag -l ${DCS_BASE_VERSION}.* | awk -F. 'BEGIN { N=0 } { if ($NF > N) N = $NF } END { print N+1 }')"
echo "New version: ${NEW_VER}"
# Save it for next steps
echo "TAG_VERSION=$NEW_VER" >> "$GITHUB_ENV"
- name: Tag Version
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${process.env.TAG_VERSION}`,
sha: context.sha
})

- name: Package Miz
run: |
# Zip up our
zip -r -q ATRM-${TAG_VERSION}.miz . -x *.md *.yml
# Zip up our mission file excluding the top level yaml and markdown and
# all git related directories
zip -r -q ATRM.miz . -x *.md *.yml '.git*'
- name: Release
- name: Tag and Release
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
let release = github.rest.repos.createRelease({
tags = await github.rest.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `${process.env.TAG_VERSION}`
})
ref: `tags/${process.env.DCS_BASE_VERSION}`
});
github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
name: `ATRM-${process.env.TAG_VERSION}.miz`,
release_id: release.id,
data: await fs.readFileSync(`ATRM-${process.env.TAG_VERSION}.miz`)
})
let next_ver = Math.max(
...(tags.data ?? []).map((x) => {
try {
return parseInt(x.ref.split(".").pop())
} catch {
return 0
}
}),
0)+1;
let next_ver_complete = `${process.env.DCS_BASE_VERSION}.${next_ver}`;
core.notice(`Tagging ${next_ver_complete}`);
let release;
try {
release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `${next_ver_complete}`,
latest: "true"
});
} catch (err) {
core.setFailed(err.message);
}
try {
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
name: `ATRM-${next_ver_complete}.miz`,
release_id: release.data.id,
data: await fs.readFileSync("ATRM.miz")
});
} catch (err) {
core.setFailed(err.message);
}

0 comments on commit f137d0c

Please sign in to comment.