github-pages #11
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: deployment | |
jobs: | |
release: | |
if: github.event.deployment.environment == 'production' | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' | |
CI: true | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '10.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install | |
- name: package | |
run: | | |
npm build | |
./build.sh package | |
- 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: Deploy on github | |
run: | | |
cd artifacts | |
version=$(ls gauge-ts* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-ts-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//"); | |
if [ -z "$version" ]; then | |
echo "Gauge version is not set" | |
exit 1 | |
fi | |
echo -e "gauge-ts v$version\n\n" > desc.txt | |
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" BugDiver gauge-ts) | |
echo "$release_description" >> desc.txt | |
echo "Creating new draft for release v$version" | |
hub release create -F ./desc.txt "v$version" | |
sleep 10 | |
echo "Start uploading assets..." | |
for i in `ls $artifacts`; do | |
hub release edit -m "" -a $i "v$version" | |
done | |
cat desc.txt | |
rm -rf desc.txt | |
- name: Deploy npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm publish --access=public | |
- name: 'deployment success' | |
if: success() | |
uses: 'deliverybot/status@master' | |
with: | |
state: 'success' | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
- name: 'deployment failure' | |
if: failure() | |
uses: 'deliverybot/status@master' | |
with: | |
state: 'failure' | |
token: '${{ secrets.GITHUB_TOKEN }}' |