From 548f9c8c04cff8114e3d3bb9f0c170bec0490a00 Mon Sep 17 00:00:00 2001 From: Jeppe Rask Date: Sat, 20 Aug 2022 16:48:49 +0200 Subject: [PATCH] Release.yml --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ .github/workflows/webpack.yml | 28 ------------------ ci/getVersion.sh | 1 + 3 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/webpack.yml create mode 100755 ci/getVersion.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..477e6be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: NodeJS with Webpack + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build + run: | + npm install + npm run build + zip -r -j static.zip dist/* + + - name: Get version + run: echo "::set-output name=version::$(./ci/getVersion.sh)" + id: version + + # - name: Verify version + # run: | + # ./ci/verifyVersion.sh + + # Verify changelog has entry with new version + + - name: Create release + uses: actions/create-release@v1 + id: create_release + with: + draft: false + prerelease: false + release_name: ${{ steps.version.outputs.version }} + tag_name: ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Upload artifacts + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: static.zip + asset_name: static.zip + asset_content_type: application/gzip \ No newline at end of file diff --git a/.github/workflows/webpack.yml b/.github/workflows/webpack.yml deleted file mode 100644 index 4d24c7f..0000000 --- a/.github/workflows/webpack.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: NodeJS with Webpack - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Build - run: | - npm install - npm run build diff --git a/ci/getVersion.sh b/ci/getVersion.sh new file mode 100755 index 0000000..efd8253 --- /dev/null +++ b/ci/getVersion.sh @@ -0,0 +1 @@ +echo $(sed 's/.*"version": "\(.*\)".*/\1/;t;d' ./package.json) \ No newline at end of file