From f20753ff3596481755898cdacc2beebf4d548397 Mon Sep 17 00:00:00 2001 From: Tjorben Schiller Date: Wed, 11 Sep 2024 14:56:29 +0200 Subject: [PATCH] ci: add github action for cd --- .github/workflows/node.js.yml | 26 ++++++++++++++++++++------ mkver.conf | 24 ++++++++++++++++++++++++ package.json | 1 + 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 mkver.conf diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index cee0706..4ceb98d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -2,9 +2,9 @@ name: Node.js on: push: - branches: [ "main" ] + branches: [ 'main' ] pull_request: - branches: [ "main" ] + branches: [ 'main' ] jobs: lint_audit: @@ -33,19 +33,33 @@ jobs: with: name: living-images-viewer path: dist - create-release: + createRelease: runs-on: ubuntu-latest - # if: github.ref_name == 'main' + # TODO if: github.ref_name == 'main' needs: [ lint_audit, build ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - uses: cperezabo/setup-git-mkver@v1.2.0 - run: echo "VERSION=v$(git mkver next --format '{Docker}')" >> $GITHUB_ENV + - run: echo '${{ env.VERSION }}' - uses: actions/download-artifact@v4 with: name: living-images-viewer + path: living-images-viewer + - run: (cd living-images-viewer && zip -r ../living-images-viewer.zip . ) - uses: ncipollo/release-action@v1 with: - artifacts: 'living-images-viewer' + artifacts: 'living-images-viewer.zip' tag: '${{ env.VERSION }}' generateReleaseNotes: 'true' + deployToProduction: + runs-on: ubuntu-latest + # TODO if: github.ref_name == 'main' + needs: [ lint_audit, build, createRelease ] + steps: + - uses: actions/download-artifact@v4 + with: + name: living-images-viewer + path: living-images-viewer + - run: sudo apt-get install -y lftp + - run: lftp -c "set net:timeout 10 ; set sftp:auto-confirm yes ; open -u ${{ secrets.FTP_KULTURSPHAERE_USERNAME }},${{ secrets.FTP_KULTURSPHAERE_PASSWORD }} ${{ secrets.FTP_KULTURSPHAERE_URL }}/${{ secrets.FTP_KULTURSPHAERE_PATH_TEST_ROOT }} ; mirror -e -R -p living-images-viewer . ; quit" diff --git a/mkver.conf b/mkver.conf new file mode 100644 index 0000000..a10ef7f --- /dev/null +++ b/mkver.conf @@ -0,0 +1,24 @@ +defaults { + tag: false + tagMessageFormat: "release {Tag}" + preReleaseFormat: "RC{PreReleaseNumber}" + includeBuildMetaData: true + whenNoValidCommitMessages: IncrementPatch + patches: [] +} +branches: [ + { + pattern: "main" + includeBuildMetaData: false + formats: [ + { name: Docker, format: "{Version}" } + ] + } + { + pattern: ".*" + formats: [ + { name: Docker, format: "{Version}-{BuildMetaData}" } + ] + } +] +patches: [] diff --git a/package.json b/package.json index fa6612f..6596649 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "serve": "export NODE_OPTIONS=--openssl-legacy-provider; vue-cli-service serve", "build": "export NODE_OPTIONS=--openssl-legacy-provider; vue-cli-service build", "lint": "vue-cli-service lint", + "lint:fix": "vue-cli-service lint --fix", "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'", "http-server": "http-server dist -c-1 --proxy http://localhost:8080?", "generate-sbom": "npx @cyclonedx/cyclonedx-npm --omit dev --omit optional --omit peer --output-file public/sbom.json",