fix ghcli release all artifacts #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- metadata.json | |
- .github | |
- README.md | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: package and releases | |
run: | | |
ignored="! -path $(pwd) " | |
for i in $(cat .templateignore); do | |
ignored+="! -name $i " | |
done | |
files=$(find $(pwd) -maxdepth 1 $ignored) | |
mkdir dotnet | |
cp -r $files ./dotnet | |
zip -r dotnet.zip ./dotnet; | |
openssl sha256 dotnet.zip | cut -d " " -f2 > dotnet.zip.sha256 | |
version=$(jq -r ".version" metadata.json) | |
gh release create --title "v$version" dotnet.zip* | |
- name: setup git | |
run: | | |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
- name: bump version | |
run: | | |
git clean -dfx | |
version=$(jq -r ".version" metadata.json | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | |
echo $(jq -r ".version = \"$version\"" metadata.json) | jq . > new_metadata.json | |
cat new_metadata.json > metadata.json | |
git add metadata.json | |
git commit -m "Bumped version to $version" | |
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" master |