diff --git a/.github/workflows/publish-canary.yaml b/.github/workflows/publish-canary.yaml new file mode 100644 index 0000000..4d5820a --- /dev/null +++ b/.github/workflows/publish-canary.yaml @@ -0,0 +1,57 @@ +name: Publish Canary build +on: + push: + paths: + - "package.json" +jobs: + get-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: extract-package-version + id: package-version + uses: Saionaro/extract-package-version@v1.0.6 + - run: "echo 'Detected version: ${{steps.package-version.outputs.version}}'" + outputs: + version: ${{steps.package-version.outputs.version}} + + lint-build-publish-canary: + needs: get-version + if: contains(needs.get-version.outputs.version, 'canary') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Setup node + - uses: actions/setup-node@v2 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + + - run: yarn install --immutable --immutable-cache --check-cache + - run: npx prettier --check . + - run: tsc -p ./tsconfig.prod.json + + - run: npm publish --tag canary + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: ./scripts/npmjs-repo-cleanup.sh + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # # Build and publish to Docker + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v1 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v1 + # - name: Login to DockerHub + # uses: docker/login-action@v1 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Build and push + # id: docker_build + # uses: docker/build-push-action@v2 + # with: + # push: true + # tags: murznn/sites-sync:${{ needs.get-version.outputs.version }},murznn/sites-sync:canary diff --git a/.github/workflows/publish-docker-canary.yaml b/.github/workflows/publish-docker-canary.yaml deleted file mode 100644 index 4b5d702..0000000 --- a/.github/workflows/publish-docker-canary.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Publish Docker canary image -on: - push: - paths: - - "package.json" -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - tags: murznn/sites-sync:${{github.ref_name}},murznn/sites-sync:canary diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml deleted file mode 100644 index cac2dee..0000000 --- a/.github/workflows/publish-docker.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Publish Docker image -on: - release: - types: [created] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - tags: murznn/sites-sync:${{github.ref_name}},murznn/sites-sync:canary diff --git a/.github/workflows/publish-npmjs-canary.yaml b/.github/workflows/publish-npmjs-canary.yaml deleted file mode 100644 index 213c0ef..0000000 --- a/.github/workflows/publish-npmjs-canary.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Publish Canary builds to npmjs -on: - push: - paths: - - "package.json" -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v2 - with: - node-version: "16.x" - registry-url: "https://registry.npmjs.org" - - run: yarn install --immutable --immutable-cache --check-cache - - run: npx prettier --check . - - run: tsc -p ./tsconfig.prod.json - - run: npm publish --tag canary - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: ./scripts/npmjs-repo-cleanup.sh - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-npmjs.yaml b/.github/workflows/publish-npmjs.yaml deleted file mode 100644 index a619a68..0000000 --- a/.github/workflows/publish-npmjs.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Package to npmjs -on: - release: - types: [created] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v2 - with: - node-version: "14.x" - registry-url: "https://registry.npmjs.org" - - run: yarn install --immutable --immutable-cache --check-cache - - run: tsc - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml new file mode 100644 index 0000000..e696307 --- /dev/null +++ b/.github/workflows/publish-release.yaml @@ -0,0 +1,59 @@ +name: Publish release +on: + release: + types: [created] +jobs: + get-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: extract-package-version + id: package-version + uses: Saionaro/extract-package-version@v1.0.6 + - run: "echo 'Detected version: ${{steps.package-version.outputs.version}}'" + outputs: + version: ${{steps.package-version.outputs.version}} + + check-release-version-match: + needs: get-version + runs-on: ubuntu-latest + if: needs.get-version.outputs.version != github.ref_name + steps: + - run: echo "Release name (${{github.ref_name}}) and package version (${{needs.get-version.outputs.version}}) don't match, failing."; exit 1; + + lint-build-publish: + needs: check-release-version-match + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v2 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - run: yarn install --immutable --immutable-cache --check-cache + - run: npx prettier --check . + - run: tsc -p ./tsconfig.prod.json + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: ./scripts/npmjs-repo-cleanup.sh + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # Build and publish to Docker + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: murznn/sites-sync:${{github.ref_name}},murznn/sites-sync:latest diff --git a/.prettierignore b/.prettierignore index de4d1f0..791627e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ dist node_modules +/CHANGELOG.md \ No newline at end of file diff --git a/README.md b/README.md index 872d18d..6968fed 100644 --- a/README.md +++ b/README.md @@ -43,5 +43,5 @@ Commands: Options: --version Show version number [boolean] -s, --site Use custom upstream site id [string] - -h, --help Show help [boolean]``` -``` \ No newline at end of file + -h, --help Show help [boolean] +```