|
1 | 1 | name: Publish
|
2 | 2 | on:
|
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
3 | 6 | schedule:
|
4 | 7 | - cron: '0 0 * * *'
|
5 | 8 | jobs:
|
6 |
| - publish: |
7 |
| - name: "Packages" |
| 9 | + release: |
| 10 | + name: Packages |
8 | 11 | if: github.repository == 'AssemblyScript/assemblyscript'
|
9 | 12 | runs-on: ubuntu-latest
|
10 | 13 | steps:
|
11 | 14 | - uses: actions/checkout@v1
|
12 | 15 | with:
|
13 |
| - ref: release |
| 16 | + ref: master |
14 | 17 | - uses: dcodeIO/setup-node-nvm@master
|
15 | 18 | with:
|
16 | 19 | node-version: current
|
17 |
| - - name: Merge master |
18 |
| - env: |
19 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
20 |
| - run: | |
21 |
| - git config user.name "GitHub Actions" |
22 |
| - git config user.email "[email protected]" |
23 |
| - git remote set-url origin "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |
24 |
| - git fetch origin |
25 |
| - git merge origin/master |
26 | 20 | - name: Install dependencies
|
27 | 21 | run: npm ci
|
28 | 22 | - name: Build distribution files
|
|
31 | 25 | npm run build
|
32 | 26 | - name: Test distribution files
|
33 | 27 | run: npm test
|
34 |
| - - name: Set up version |
35 |
| - run: | |
36 |
| - VERSION=$(node -e "console.log(require('./package.json').version)") |
37 |
| - git add --force dist/* |
38 |
| - if git rev-parse v$VERSION >/dev/null 2>&1; then |
39 |
| - VERSION=$VERSION-nightly.$(date "+%Y%m%d") |
40 |
| - if git rev-parse v$VERSION >/dev/null 2>&1; then |
41 |
| - echo "Nightly $VERSION does already exist." |
42 |
| - exit 1 |
43 |
| - fi |
44 |
| - echo ::set-env name=CHANNEL::nightly |
45 |
| - echo "Committing nightly ($VERSION) ..." |
46 |
| - git commit -m "Nightly v$VERSION" |
47 |
| - npm version $VERSION --no-git-tag-version --force |
48 |
| - else |
49 |
| - echo ::set-env name=CHANNEL::latest |
50 |
| - echo "Committing release ($VERSION) ..." |
51 |
| - git commit --allow-empty -m "Release v$VERSION" |
52 |
| - fi |
53 |
| - echo ::set-env name=VERSION::$VERSION |
54 |
| - cd lib/loader |
55 |
| - npm version $VERSION --no-git-tag-version --force |
56 |
| - cd ../.. |
57 |
| - - name: Create tag and push distribution files |
58 |
| - run: | |
59 |
| - git tag v$VERSION |
60 |
| - git push origin release |
61 |
| - git push origin v$VERSION |
62 |
| - - name: Publish to npm |
| 28 | + - name: Make semantic release |
63 | 29 | env:
|
64 |
| - NPM_REGISTRY: "registry.npmjs.org" |
65 |
| - NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
66 |
| - run: | |
67 |
| - npm config set "//${NPM_REGISTRY}/:_authToken=${NPM_AUTH_TOKEN}" |
68 |
| - npm publish --tag $CHANNEL |
69 |
| - cd lib/loader |
70 |
| - npm publish --tag $CHANNEL --access public |
71 |
| - cd ../.. |
72 |
| - # - name: Publish to gpr |
73 |
| - # env: |
74 |
| - # NPM_REGISTRY: "npm.pkg.github.com" |
75 |
| - # NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
76 |
| - # run: | |
77 |
| - # npm config set "//${NPM_REGISTRY}/:_authToken=${NPM_AUTH_TOKEN}" |
78 |
| - # sed -i 's/"assemblyscript"/"@assemblyscript\/assemblyscript"/' package.json |
79 |
| - # sed -i 's/"assemblyscript"/"@assemblyscript\/assemblyscript"/' package-lock.json |
80 |
| - # npm publish --registry=https://${NPM_REGISTRY} |
81 |
| - # cd lib/loader |
82 |
| - # npm publish --registry=https://${NPM_REGISTRY} |
83 |
| - # cd ../.. |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 32 | + run: node node_modules/semantic-release/bin/semantic-release.js --unstable --dry-run |
0 commit comments