-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
env: | ||
RELEASE_FILE_NAME: 'css-pokemon-gameboy-${{ github.ref_name }}.zip' | ||
RELEASE_FILE_NAME: 'css-pokemon-gameboy-${{ github.ref_name }}' | ||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -28,21 +28,32 @@ jobs: | |
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build the css to dist-release | ||
- name: Build the minified css to dist-release | ||
run: npm run build:css | ||
|
||
- name: Zip Release | ||
uses: TheDoctor0/[email protected] | ||
with: | ||
type: 'zip' | ||
filename: ${{ env.RELEASE_FILE_NAME }} | ||
filename: ../${{ env.RELEASE_FILE_NAME }}.min.zip | ||
path: 'template.html styles' | ||
directory: 'dist-release' | ||
|
||
- name: Build the full css to dist-release | ||
run: npm run build:css:full | ||
|
||
- name: Zip Release | ||
uses: TheDoctor0/[email protected] | ||
with: | ||
type: 'zip' | ||
filename: ../${{ env.RELEASE_FILE_NAME }}.zip | ||
path: 'template.html styles' | ||
directory: 'dist-release' | ||
|
||
- name: Create Release on GitHub | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: 'dist-release/${{ env.RELEASE_FILE_NAME }}' | ||
artifacts: '${{ env.RELEASE_FILE_NAME }}.min.zip,${{ env.RELEASE_FILE_NAME }}.zip' | ||
removeArtifacts: true | ||
body: 'Automatic release created by GitHub Action.' | ||
prerelease: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { resolve, join } from 'path' | ||
import { defineConfig } from 'vite' | ||
import fs from 'fs' | ||
|
||
const outDir = 'dist-release' | ||
const outDirCss = `${outDir}/styles` | ||
|
||
export default defineConfig({ | ||
build: { | ||
outDir: outDirCss, | ||
lib: { | ||
entry: resolve(__dirname, 'src/lib.ts'), | ||
name: 'CssPokemonGameboy', | ||
fileName: 'css-pokemon-gameboy', | ||
}, | ||
rollupOptions: { | ||
external: [ | ||
'prismjs', 'redent' | ||
], | ||
output: { | ||
assetFileNames: "css-pokemon-gameboy.[ext]", | ||
}, | ||
}, | ||
}, | ||
plugins: [ | ||
{ | ||
// We are only interested in the compiled css | ||
name: 'postbuild-clear-js', | ||
closeBundle: async () => { | ||
const dist = resolve(__dirname, outDirCss) | ||
|
||
fs.readdirSync(dist).forEach(file => { | ||
if (file.endsWith('.js') || file.endsWith('.cjs')) { | ||
fs.unlinkSync(join(dist, file)) | ||
} | ||
}) | ||
} | ||
}, | ||
{ | ||
name: 'postbuild-copy-template', | ||
closeBundle: async () => { | ||
const dist = resolve(__dirname, outDir) | ||
const template = resolve(__dirname, 'template.html') | ||
|
||
fs.copyFileSync(template, join(dist, 'template.html')) | ||
} | ||
}, | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,3 @@ | ||
import { resolve, join } from 'path' | ||
import { defineConfig } from 'vite' | ||
import fs from 'fs' | ||
import config from './vite.lib.common.js' | ||
|
||
const outDir = 'dist-release' | ||
const outDirCss = `${outDir}/styles` | ||
|
||
export default defineConfig({ | ||
build: { | ||
outDir: outDirCss, | ||
lib: { | ||
entry: resolve(__dirname, 'src/lib.ts'), | ||
name: 'CssPokemonGameboy',//todo | ||
fileName: 'css-pokemon-gameboy', | ||
}, | ||
rollupOptions: { | ||
external: [ | ||
'prismjs', 'redent' | ||
], | ||
output: { | ||
assetFileNames: "css-pokemon-gameboy.[ext]", | ||
}, | ||
}, | ||
}, | ||
plugins: [ | ||
{ | ||
// We are only interested in the compiled css | ||
name: 'postbuild-clear-js', | ||
closeBundle: async () => { | ||
const dist = resolve(__dirname, outDirCss) | ||
|
||
fs.readdirSync(dist).forEach(file => { | ||
if (file.endsWith('.js') || file.endsWith('.cjs')) { | ||
fs.unlinkSync(join(dist, file)) | ||
} | ||
}) | ||
} | ||
}, | ||
{ | ||
name: 'postbuild-copy-template', | ||
closeBundle: async () => { | ||
const dist = resolve(__dirname, outDir) | ||
const template = resolve(__dirname, 'template.html') | ||
|
||
fs.copyFileSync(template, join(dist, 'template.html')) | ||
} | ||
}, | ||
] | ||
}) | ||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import config from './vite.lib.common.js' | ||
|
||
config.build.cssMinify = false | ||
|
||
export default config |