From 6f515ea3368f232a6463325c75e391df12d87a0d Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Sun, 12 Nov 2023 15:45:09 +0200 Subject: [PATCH] wip fix fly_io deploy --- .github/workflows/release.yml | 187 +--------------------------------- 1 file changed, 4 insertions(+), 183 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce98cae5e..fa7088c66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,200 +2,21 @@ name: Release - build & publish modules and server, build & publish docker conta on: push: + branches: + - fly_io tags: - 'v*' + workflow_dispatch: jobs: - server-admin-ui-dependencies: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: | - if [[ "$(npm view @signalk/server-admin-ui-dependencies version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-admin-ui-dependencies/package.json)" ]]; then - cd packages/server-admin-ui-dependencies - npm install --package-lock-only - npm ci && npm cache clean --force - npm publish --access public - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - server-admin-ui: - runs-on: ubuntu-latest - needs: server-admin-ui-dependencies - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: | - if [[ "$(npm view @signalk/server-admin-ui version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-admin-ui/package.json)" ]]; then - cd packages/server-admin-ui - npm install --package-lock-only - npm ci && npm cache clean --force - npm publish --access public - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - server-api: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: | - if [[ "$(npm view @signalk/server-api version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/server-api/package.json)" ]]; then - cd packages/server-api - npm install --package-lock-only - npm ci && npm cache clean --force - npm publish --access public - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - streams: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: | - if [[ "$(npm view @signalk/streams version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/streams/package.json)" ]]; then - cd packages/streams - npm install --package-lock-only - npm ci && npm cache clean --force - npm publish --access public - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - resources-provider-plugin: - needs: server-api - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: | - if [[ "$(npm view @signalk/resources-provider version)" != "$(awk '/"version":/{gsub(/("|",)/,"",$2);print $2}' packages/resources-provider-plugin/package.json)" ]]; then - # to disable workspaces, otherwise npm will not install @signalk/server-api - rm package.json - cd packages/resources-provider-plugin - npm install --package-lock-only - npm ci && npm cache clean --force - npm publish --access public - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - signalk-server: - runs-on: ubuntu-latest - needs: [server-admin-ui, server-api, streams, resources-provider-plugin] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - name: Set tag variable - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/}) - - name: Install, build & publish - run: | - npm install --package-lock-only - npm ci && npm cache clean --force - if [[ "${{ steps.vars.outputs.tag }}" == *beta* ]]; - then - npm publish --tag beta - else - npm publish - fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - release: - permissions: - contents: write - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} - - - name: Create Release - uses: actions/create-release@v1 - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: ${{steps.github_release.outputs.changelog}} - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} - - docker_image: - runs-on: ubuntu-latest - needs: signalk-server - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v4 - with: - images: | - signalk/signalk-server - ghcr.io/signalk/signalk-server - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: signalkci - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to ghcr.io - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_PAT }} # Personal access tokens (classic) with a scope of "write:packages" is needed to release ghcr.io package registry. - - name: Set TAG for build-args - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/}) - - name: Build and push - uses: docker/build-push-action@v4 - with: - file: ./docker/Dockerfile_rel - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: true - tags: ${{ steps.docker_meta.outputs.tags }} - build-args: | - TAG=${{ steps.vars.outputs.tag }} - deploy_fly: runs-on: ubuntu-latest - needs: docker_image steps: - name: Setup flyctl uses: superfly/flyctl-actions/setup-flyctl@master - name: Deploy demo.signalk.org at fly.io - working-directory: ./fly_io/demo_signalk_org + working-directory: ${{ github.workspace }}/fly_io/demo_signalk_org run: flyctl deploy --remote-only --build-arg SK_VERSION=${{ steps.vars.outputs.tag }} env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}