Skip to content

Commit

Permalink
Rework Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MurzNN committed Feb 22, 2022
1 parent 254427e commit 1cde4b8
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 92 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/publish-canary.yaml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 0 additions & 24 deletions .github/workflows/publish-docker-canary.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/publish-docker.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/publish-npmjs-canary.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/publish-npmjs.yaml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
/CHANGELOG.md
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Commands:
Options:
--version Show version number [boolean]
-s, --site Use custom upstream site id [string]
-h, --help Show help [boolean]```
```
-h, --help Show help [boolean]
```

0 comments on commit 1cde4b8

Please sign in to comment.