add variable to sync script #131
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: Branch and tag based release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: npm run build | |
- name: Publish to npm | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: npm publish --access=public | |
working-directory: packages/server | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Login to Dockerhub | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to Dockerhub | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: packages/server | |
push: true | |
tags: osmoscraft/osmosnote:latest | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false |