mirror of
https://github.com/unraid/api.git
synced 2026-01-08 09:39:49 -06:00
56
.github/release.sh
vendored
Normal file
56
.github/release.sh
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# https://unix.stackexchange.com/a/9443/119653
|
||||
reverse () {
|
||||
local line
|
||||
if IFS= read -r line
|
||||
then
|
||||
reverse
|
||||
printf '%s\n' "$line"
|
||||
fi
|
||||
}
|
||||
|
||||
IS_TAG=$(git tag -l --points-at HEAD)
|
||||
RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
RELEASE=$(echo $RELEASE_TAG | awk -F- '{print $1}')
|
||||
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
||||
ROLLING_TAG="$RELEASE-rolling-$TIMESTAMP"
|
||||
REPO=$(echo "${REPO#*/}")
|
||||
ORG="unraid"
|
||||
|
||||
# If tag then upload files for the tag
|
||||
if [[ ! -z "$IS_TAG" ]]; then
|
||||
# Compare to the last known semver version so we get the whole changelog
|
||||
LAST_RELEASE=$(git tag --list --sort=v:refname | grep -v rolling | reverse | sed -n 2p)
|
||||
RELEASE_NOTES=$(git log "$LAST_RELEASE...HEAD~1" --pretty=format:"- %s [\`%h\`](http://github.com/$ORG/$REPO/commit/%H)" --reverse)
|
||||
|
||||
# Add title and body
|
||||
printf "$RELEASE\n\n$RELEASE_NOTES" > release.md
|
||||
# Release
|
||||
if [[ $* == *--dry* ]]; then
|
||||
echo "Type: Release"
|
||||
echo "Tag: $RELEASE_TAG"
|
||||
echo "Release: $LAST_RELEASE"
|
||||
echo "----------"
|
||||
cat release.md
|
||||
else
|
||||
hub release create -a unraid-$REPO-*.tgz -F release.md -p $RELEASE_TAG
|
||||
fi
|
||||
else
|
||||
# Otherwise upload files to the rolling release
|
||||
|
||||
# Create release notes
|
||||
RELEASE_NOTES=$(git log "$RELEASE_TAG...HEAD" --pretty=format:"- %s [\`%h\`](http://github.com/$ORG/$REPO/commit/%H)" --reverse)
|
||||
# Add title and body
|
||||
printf "$ROLLING_TAG\n\n$RELEASE_NOTES" > release.md
|
||||
# Release
|
||||
if [[ $* == *--dry* ]]; then
|
||||
echo "Type: Rolling"
|
||||
echo "Tag: $ROLLING_TAG"
|
||||
echo "Release: $RELEASE"
|
||||
echo "----------"
|
||||
cat release.md
|
||||
else
|
||||
hub release create -a unraid-$REPO-*.tgz -F release.md -p $ROLLING_TAG
|
||||
fi
|
||||
fi
|
||||
10
.github/workflows/production.yml
vendored
10
.github/workflows/production.yml
vendored
@@ -37,9 +37,11 @@ jobs:
|
||||
run: npm run build
|
||||
- name: Packing release
|
||||
run: npm pack
|
||||
- name: Uploading release to Github
|
||||
uses: OmgImAlexis/upload-to-release@master
|
||||
with:
|
||||
args: unraid-graphql-api-*.tgz
|
||||
- name: Install hub
|
||||
uses: geertvdc/setup-hub@master
|
||||
- name: Create the release
|
||||
env:
|
||||
GITHUB_USER: ${{ secrets.GITHUB_USER }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: .github/release.sh
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
"author": "Alexis Tyler <xo@wvvw.me> (https://wvvw.me/)",
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"commit": "npx git-cz",
|
||||
"dev": "STATES_CWD=$(pwd)/../core/test/fixtures/states CORE_CWD=$(pwd)/../core/ PLUGINS_CWD=$(pwd)/../plugins/ nodemon -e js,graphql --signal SIGINT index.js",
|
||||
"test": "exit 0",
|
||||
"lint": "exit 0",
|
||||
"build": "modclean --no-progress --run --path ."
|
||||
},
|
||||
"files": [
|
||||
"app/**/*",
|
||||
"*.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@gridplus/docker-events": "^1.0.0",
|
||||
"@unraid/core": "unraid/core#c432714",
|
||||
|
||||
Reference in New Issue
Block a user