From b935ffa3bd6f56638da91b16d80a722ce88fa155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Tue, 3 Mar 2020 17:33:52 +0100 Subject: [PATCH] Prepare release script --- .github/workflows/publish.yml | 33 +++++++++++++++++++++++ .github/workflows/release.yml | 50 +++++++++++++++++++++++++++++++++++ package.json | 7 +++-- 3 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..349edce --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish + +on: + release: + types: [created, published] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: NPM + run: npm install + - name: Publish + run: npm run release + env: + VER: ${{ github.ref }} + WEXT_SHIPIT_CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} + WEXT_SHIPIT_CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} + WEXT_SHIPIT_CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} + WEXT_SHIPIT_CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + WEXT_SHIPIT_FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }} + WEXT_SHIPIT_FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..35227b6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release + +on: [push] +# schedule: +# - cron: '0 4 * * *' + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm test + env: + CI: true + - name: Generate release name + id: release_name + run: | + echo "::set-output name=version::$(npx daily-version)" + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.release_name.outputs.version }} + release_name: Release ${{ steps.release_name.outputs.version }} + - name: Publish + run: npm run release + env: + VER: ${{ steps.release_name.outputs.version }} + WEXT_SHIPIT_CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} + WEXT_SHIPIT_CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} + WEXT_SHIPIT_CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} + WEXT_SHIPIT_CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + WEXT_SHIPIT_FIREFOX_JWT_ISSUER: ${{ secrets.JWT_USER }} + WEXT_SHIPIT_FIREFOX_JWT_SECRET: ${{ secrets.JWT_SECRET }} diff --git a/package.json b/package.json index 53a5f51..04e92b0 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,11 @@ "test": "npm run lint && cross-env BABEL_ENV=testing ava && run-s build", "build": "webpack --mode=production -p", "start": "webpack --mode=development --watch", - "release:amo": "shipit firefox distribution", - "release:cws": "shipit chrome distribution", + "publish:amo": "shipit firefox distribution", + "publish:cws": "shipit chrome distribution", "prerelease:version": "dot-json distribution/manifest.json version $VER", "prerelease:source-url": "echo https://github.com/DesignandHuman/qui-possede-les-medias/archive/\"${GITHUB_SHA:-$VER}\".zip > distribution/SOURCE_URL", - "release": "VER=$(daily-version) npm-run-all build prerelease:* create-git-tag release:*", - "create-git-tag": "git tag $VER -m $VER && git push origin $VER" + "release": "npm-run-all build prerelease:* publish:*" }, "dependencies": { "element-ready": "^4.0.0",