From 214462698b2f26e72caebb602cd322c2856cc954 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 8 Nov 2019 00:48:04 +0100 Subject: [PATCH] Publish preparations --- .github/workflows/ci.yml | 6 ++- .github/workflows/publish.yml | 76 +++++++++++++++++++++++++++++++++++ lib/loader/package.json | 2 +- package.json | 2 +- 4 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abd44054ae..2d1c5a442b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: jobs: check: name: "Check preconditions" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..0de8fd105a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,76 @@ +name: Publish +on: + schedule: + - cron: '0 5 * * *' +jobs: + publish: + name: "Publish packages" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + ref: release + - name: Merge master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git remote set-url origin "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git fetch origin + git merge origin/master + - uses: actions/setup-node@v1 + - name: Install dependencies + run: npm ci + - name: Build distribution files + run: | + npm run clean + npm run build + - name: Test distribution files + run: npm test + - name: Set up version + run: | + VERSION=$(node -e "console.log(require('./package.json').version)") + git add --force dist/* + if git rev-parse v$VERSION >/dev/null 2>&1; then + VERSION=$VERSION-nightly.$(date "+%Y%m%d") + if git rev-parse v$VERSION >/dev/null 2>&1; then + echo "Nightly $VERSION does already exist." + exit 1 + fi + echo ::set-env name=CHANNEL::nightly + echo "Committing nightly ($VERSION) ..." + git commit -m "Nightly v$VERSION" + npm version $VERSION --no-git-tag-version --force + else + echo ::set-env name=CHANNEL::latest + echo "Committing release ($VERSION) ..." + git commit --allow-empty -m "Release v$VERSION" + fi + echo ::set-env name=VERSION::$VERSION + - name: Create tag and push distribution files + run: | + git tag v$VERSION + git push origin release + git push origin v$VERSION + # - name: Publish to npm + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # run: | + # echo "npm publish --tag $CHANNEL" + # cd ./lib/loader + # npm version $VERSION --no-git-tag-version --force + # echo "npm publish --tag $CHANNEL" + # cd ../.. + # - uses: actions/setup-node@v1 + # with: + # registry-url: 'https://npm.pkg.github.com' + # scope: '@AssemblyScript' + # - name: Publish to gpr + # env: + # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # echo "npm publish --tag $CHANNEL" + # cd ./lib/loader + # echo "npm publish --tag $CHANNEL" + # cd ../.. diff --git a/lib/loader/package.json b/lib/loader/package.json index 0edaf3fab3..fdb566c509 100644 --- a/lib/loader/package.json +++ b/lib/loader/package.json @@ -1,6 +1,6 @@ { "name": "@assemblyscript/loader", - "version": "1.0.0", + "version": "0.0.0", "main": "index.js", "types": "index.d.ts", "scripts": { diff --git a/package.json b/package.json index ca6d2111ff..54f06fef63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "assemblyscript", - "version": "0.7.0", + "version": "0.8.0", "author": "Daniel Wirtz ", "license": "Apache-2.0", "repository": {