Files
discordeno/.github/workflows/release.yml
ITOH e4a91b77d0 ci(workflows): fix publish to npm on version constant update (#2118)
GitHub workflows cannot trigger another workflow. Due to this the npm workflow currently did not run on a version constant update.
Since we will only publish with a version constant update there should be no problem when we move the npm release in there.

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2022-03-20 10:50:38 -04:00

38 lines
1.3 KiB
YAML

name: Release
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
deno: ["v1.x"]
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@main
with:
deno-version: ${{ matrix.deno }}
- name: Get last tag version
run: |
echo "DISCORDENO_VERSION_OLD=$(wget -O- -q https://deno.land/x/discordeno/util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV
- name: Get new tag version
run: echo "DISCORDENO_VERSION=$(cat util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV
- name: Create tag
if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }}
run: git tag ${{ env.DISCORDENO_VERSION }} && git push --tags
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: build npm
run: deno run -A ./dnt.ts ${{ env.DISCORDENO_VERSION }}
- name: npm publish
if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: cd npm && npm publish