diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 00000000..34d83b47 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,8 @@ +runs: + using: composite + steps: + - + name: Setup node + uses: actions/setup-node@v2 + with: + node-version: 16.x diff --git a/.github/workflows/checks.build.yaml b/.github/workflows/checks.build.yaml index 654319f2..096a57b4 100644 --- a/.github/workflows/checks.build.yaml +++ b/.github/workflows/checks.build.yaml @@ -18,9 +18,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci @@ -42,9 +40,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci diff --git a/.github/workflows/checks.quality.yaml b/.github/workflows/checks.quality.yaml index e5fb4eb5..0af7bdee 100644 --- a/.github/workflows/checks.quality.yaml +++ b/.github/workflows/checks.quality.yaml @@ -19,9 +19,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci - name: Lint diff --git a/.github/workflows/checks.security.yaml b/.github/workflows/checks.security.yaml index 9138edc2..4d03041a 100644 --- a/.github/workflows/checks.security.yaml +++ b/.github/workflows/checks.security.yaml @@ -16,9 +16,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: NPM audit run: exit "$(npm audit)" # Since node 15.x, it does not fail with error if we don't explicitly exit diff --git a/.github/workflows/release.desktop.yaml b/.github/workflows/release.desktop.yaml index 5601ce3d..247b145f 100644 --- a/.github/workflows/release.desktop.yaml +++ b/.github/workflows/release.desktop.yaml @@ -20,9 +20,7 @@ jobs: - name: Checkout to bump commit run: git checkout "$(git rev-list "${{ github.event.release.tag_name }}"..master | tail -1)" - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci - name: Run unit tests @@ -31,4 +29,4 @@ jobs: run: npm run electron:build -- -p always # https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#upload-release-to-github env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - EP_GH_IGNORE_TIME: true # Otherwise publishing fails if GitHub release is more than 2 hours old https://github.com/electron-userland/electron-builder/issues/2074 \ No newline at end of file + EP_GH_IGNORE_TIME: true # Otherwise publishing fails if GitHub release is more than 2 hours old https://github.com/electron-userland/electron-builder/issues/2074 diff --git a/.github/workflows/release.site.yaml b/.github/workflows/release.site.yaml index f390aae0..f721d99d 100644 --- a/.github/workflows/release.site.yaml +++ b/.github/workflows/release.site.yaml @@ -1,8 +1,8 @@ name: release-site on: - release: - types: [created] # will be triggered when a NON-draft release is created and published. + release: + types: [created] # will be triggered when a NON-draft release is created and published. jobs: aws-deploy: # see: https://github.com/undergroundwires/aws-static-site-with-cd @@ -77,30 +77,28 @@ jobs: name: "App: Checkout" uses: actions/checkout@v2 with: - path: site + path: app ref: master # otherwise we don't get version bump commit - name: "App: Setup node" - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./app/.github/actions/setup-node - name: "App: Install dependencies" run: npm ci - working-directory: site + working-directory: app - name: "App: Run unit tests" run: npm run test:unit - working-directory: site + working-directory: app - name: "App: Build" run: npm run build - working-directory: site + working-directory: app - name: "App: Deploy to S3" run: >- bash "aws/scripts/deploy/deploy-to-s3.sh" \ - --folder site/dist \ + --folder app/dist \ --web-stack-name privacysexy-web-stack --web-stack-s3-name-output-name S3BucketName \ --storage-class ONEZONE_IA \ --role-arn ${{secrets.AWS_S3_SITE_DEPLOYMENT_ROLE_ARN}} \ diff --git a/.github/workflows/tests.e2e.yaml b/.github/workflows/tests.e2e.yaml index 58d948ad..ee643fc6 100644 --- a/.github/workflows/tests.e2e.yaml +++ b/.github/workflows/tests.e2e.yaml @@ -17,9 +17,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci diff --git a/.github/workflows/tests.integration.yaml b/.github/workflows/tests.integration.yaml index 805ace07..d60c7b64 100644 --- a/.github/workflows/tests.integration.yaml +++ b/.github/workflows/tests.integration.yaml @@ -19,9 +19,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci diff --git a/.github/workflows/tests.unit.yaml b/.github/workflows/tests.unit.yaml index f9cfd5c0..d1aad9e6 100644 --- a/.github/workflows/tests.unit.yaml +++ b/.github/workflows/tests.unit.yaml @@ -16,10 +16,8 @@ jobs: name: Checkout uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: 15.x + name: Set-up node + uses: ./.github/actions/setup-node - name: Install dependencies run: npm ci diff --git a/docs/ci-cd.md b/docs/ci-cd.md index 747b7ef5..f85d8a37 100644 --- a/docs/ci-cd.md +++ b/docs/ci-cd.md @@ -12,9 +12,9 @@ Everything that's merged in the master goes directly to production. privacy.sexy uses [GitHub actions](https://github.com/features/actions) to define and run pipelines as code. -GitHub workflows i.e. pipelines exist in [`/.github/.workflows/`](./../.github/workflows/) folder without any subfolders due to GitHub actions requirements [1] . +GitHub workflows i.e. pipelines exist in [`/.github/workflows/`](./../.github/workflows/) folder without any subfolders due to GitHub actions requirements [1] . -[1]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows +Local GitHub actions are defined in [`/.github/actions/`](./../.github/actions/) and used to reuse same workflow steps. ## Pipeline types