mirror of https://github.com/coder/code-server.git
refactor: get version dynamically (#5753)
* refactor: get version dynamically * chore: remove version * fixup: missing quotes * refactor: drop global VERSION * wip: updating ersion in publish * refactor: update publish.yaml with version changes * refactor: release.yaml with new version changes * refactor: update build.yaml with version changes * chore: update maintainer * fixup: update version in build-vscode * fixup: fix github env version * try macos only * try again * last resort * joe again * this oneee * fixup: this should work * try using inputs * docs: update release notes * fixup!: use env.VERSION in docker step * fixup!: comment get and set version * fixup!: remove compress release package comment * fixup!: use $VERSION in npm-version * refactor: set VERSION in build VS Code step * refactor: use 0.0.0 in package.json version * refactor: delete release-prep script * Update ci/build/build-vscode.sh * fixup!: remove extra VERSION set in aur
This commit is contained in:
parent
5a8bb2b8e8
commit
b978655c07
|
@ -187,10 +187,6 @@ jobs:
|
||||||
id: vscode-rev
|
id: vscode-rev
|
||||||
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
|
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
|
||||||
|
|
||||||
- name: Get version
|
|
||||||
id: version
|
|
||||||
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
|
||||||
|
|
||||||
# We need to rebuild when we have a new version of Code, when any of
|
# We need to rebuild when we have a new version of Code, when any of
|
||||||
# the patches changed, or when the code-server version changes (since
|
# the patches changed, or when the code-server version changes (since
|
||||||
# it gets embedded into the code). Use VSCODE_CACHE_VERSION to
|
# it gets embedded into the code). Use VSCODE_CACHE_VERSION to
|
||||||
|
@ -200,9 +196,11 @@ jobs:
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: lib/vscode-reh-web-*
|
path: lib/vscode-reh-web-*
|
||||||
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
|
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
|
||||||
|
|
||||||
- name: Build vscode
|
- name: Build vscode
|
||||||
|
env:
|
||||||
|
VERSION: "0.0.0"
|
||||||
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
||||||
run: yarn build:vscode
|
run: yarn build:vscode
|
||||||
|
|
||||||
|
@ -261,6 +259,12 @@ jobs:
|
||||||
- name: Run ./ci/steps/publish-npm.sh
|
- name: Run ./ci/steps/publish-npm.sh
|
||||||
run: yarn publish:npm
|
run: yarn publish:npm
|
||||||
env:
|
env:
|
||||||
|
# NOTE@jsjoeio
|
||||||
|
# This is because npm enforces semantic versioning
|
||||||
|
# so it has to be a valid version. We only use this
|
||||||
|
# to publish dev versions from prs
|
||||||
|
# and beta versions from main.
|
||||||
|
VERSION: "0.0.0"
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
# NOTE@jsjoeio
|
# NOTE@jsjoeio
|
||||||
|
|
|
@ -4,6 +4,11 @@ on:
|
||||||
# Shows the manual trigger in GitHub UI
|
# Shows the manual trigger in GitHub UI
|
||||||
# helpful as a back-up in case the GitHub Actions Workflow fails
|
# helpful as a back-up in case the GitHub Actions Workflow fails
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: The version to publish (include "v", i.e. "v4.9.1").
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
|
||||||
release:
|
release:
|
||||||
types: [released]
|
types: [released]
|
||||||
|
@ -24,21 +29,25 @@ jobs:
|
||||||
- name: Checkout code-server
|
- name: Checkout code-server
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Get version
|
|
||||||
id: version
|
|
||||||
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
|
||||||
|
|
||||||
- name: Download npm package from release artifacts
|
- name: Download npm package from release artifacts
|
||||||
uses: robinraju/release-downloader@v1.5
|
uses: robinraju/release-downloader@v1.5
|
||||||
with:
|
with:
|
||||||
repository: "coder/code-server"
|
repository: "coder/code-server"
|
||||||
tag: v${{ steps.version.outputs.version }}
|
tag: ${{ github.event.inputs.version || github.ref_name }}
|
||||||
fileName: "package.tar.gz"
|
fileName: "package.tar.gz"
|
||||||
out-file-path: "release-npm-package"
|
out-file-path: "release-npm-package"
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Publish npm package and tag with "latest"
|
- name: Publish npm package and tag with "latest"
|
||||||
run: yarn publish:npm
|
run: yarn publish:npm
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
NPM_ENVIRONMENT: "production"
|
NPM_ENVIRONMENT: "production"
|
||||||
|
@ -62,9 +71,18 @@ jobs:
|
||||||
git config --global user.name cdrci
|
git config --global user.name cdrci
|
||||||
git config --global user.email opensource@coder.com
|
git config --global user.email opensource@coder.com
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Bump code-server homebrew version
|
- name: Bump code-server homebrew version
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
|
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
|
||||||
|
|
||||||
run: ./ci/steps/brew-bump.sh
|
run: ./ci/steps/brew-bump.sh
|
||||||
|
|
||||||
aur:
|
aur:
|
||||||
|
@ -73,6 +91,7 @@ jobs:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# We need to checkout code-server so we can get the version
|
# We need to checkout code-server so we can get the version
|
||||||
- name: Checkout code-server
|
- name: Checkout code-server
|
||||||
|
@ -81,13 +100,6 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
path: "./code-server"
|
path: "./code-server"
|
||||||
|
|
||||||
- name: Get code-server version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
pushd code-server
|
|
||||||
echo "::set-output name=version::$(jq -r .version package.json)"
|
|
||||||
popd
|
|
||||||
|
|
||||||
- name: Checkout code-server-aur repo
|
- name: Checkout code-server-aur repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
@ -106,10 +118,17 @@ jobs:
|
||||||
git config --global user.name cdrci
|
git config --global user.name cdrci
|
||||||
git config --global user.email opensource@coder.com
|
git config --global user.email opensource@coder.com
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Validate package
|
- name: Validate package
|
||||||
uses: hapakaien/archlinux-package-action@v2
|
uses: hapakaien/archlinux-package-action@v2
|
||||||
with:
|
with:
|
||||||
pkgver: ${{ steps.version.outputs.version }}
|
pkgver: ${{ env.VERSION }}
|
||||||
updpkgsums: true
|
updpkgsums: true
|
||||||
srcinfo: true
|
srcinfo: true
|
||||||
|
|
||||||
|
@ -147,19 +166,23 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get version
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
id: version
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Download release artifacts
|
- name: Download release artifacts
|
||||||
uses: robinraju/release-downloader@v1.5
|
uses: robinraju/release-downloader@v1.5
|
||||||
with:
|
with:
|
||||||
repository: "coder/code-server"
|
repository: "coder/code-server"
|
||||||
tag: v${{ steps.version.outputs.version }}
|
tag: v${{ env.VERSION }}
|
||||||
fileName: "*.deb"
|
fileName: "*.deb"
|
||||||
out-file-path: "release-packages"
|
out-file-path: "release-packages"
|
||||||
|
|
||||||
- name: Publish to Docker
|
- name: Publish to Docker
|
||||||
run: yarn publish:docker
|
run: yarn publish:docker
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
|
@ -2,6 +2,11 @@ name: Draft release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: The version to publish (include "v", i.e. "v4.9.1").
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # For creating releases.
|
contents: write # For creating releases.
|
||||||
|
@ -21,6 +26,7 @@ jobs:
|
||||||
name: x86-64 Linux build
|
name: x86-64 Linux build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
needs: npm-version
|
||||||
container: "centos:7"
|
container: "centos:7"
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
@ -51,15 +57,10 @@ jobs:
|
||||||
- name: Install yarn
|
- name: Install yarn
|
||||||
run: npm install -g yarn
|
run: npm install -g yarn
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download npm package
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
id: download
|
|
||||||
with:
|
with:
|
||||||
branch: ${{ github.ref }}
|
name: npm-release-package
|
||||||
workflow: build.yaml
|
|
||||||
workflow_conclusion: completed
|
|
||||||
check_artifacts: true
|
|
||||||
name: npm-package
|
|
||||||
|
|
||||||
- name: Decompress npm package
|
- name: Decompress npm package
|
||||||
run: tar -xzf package.tar.gz
|
run: tar -xzf package.tar.gz
|
||||||
|
@ -91,7 +92,16 @@ jobs:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
if: success()
|
if: success()
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build packages with nfpm
|
- name: Build packages with nfpm
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
run: yarn package
|
run: yarn package
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
|
@ -123,6 +133,7 @@ jobs:
|
||||||
name: Linux cross-compile builds
|
name: Linux cross-compile builds
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
needs: npm-version
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -159,15 +170,10 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
|
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download npm package
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
id: download
|
|
||||||
with:
|
with:
|
||||||
branch: ${{ github.ref }}
|
name: npm-release-package
|
||||||
workflow: build.yaml
|
|
||||||
workflow_conclusion: completed
|
|
||||||
check_artifacts: true
|
|
||||||
name: npm-package
|
|
||||||
|
|
||||||
- name: Decompress npm package
|
- name: Decompress npm package
|
||||||
run: tar -xzf package.tar.gz
|
run: tar -xzf package.tar.gz
|
||||||
|
@ -181,7 +187,16 @@ jobs:
|
||||||
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
|
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
|
||||||
mv ./node ./release-standalone/lib/node
|
mv ./node ./release-standalone/lib/node
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build packages with nfpm
|
- name: Build packages with nfpm
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
run: yarn package ${NPM_CONFIG_ARCH}
|
run: yarn package ${NPM_CONFIG_ARCH}
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
|
@ -194,6 +209,7 @@ jobs:
|
||||||
name: x86-64 macOS build
|
name: x86-64 macOS build
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
needs: npm-version
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -209,15 +225,10 @@ jobs:
|
||||||
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download npm package
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
id: download
|
|
||||||
with:
|
with:
|
||||||
branch: ${{ github.ref }}
|
name: npm-release-package
|
||||||
workflow: build.yaml
|
|
||||||
workflow_conclusion: completed
|
|
||||||
check_artifacts: true
|
|
||||||
name: npm-package
|
|
||||||
|
|
||||||
- name: Decompress npm package
|
- name: Decompress npm package
|
||||||
run: tar -xzf package.tar.gz
|
run: tar -xzf package.tar.gz
|
||||||
|
@ -241,7 +252,16 @@ jobs:
|
||||||
- name: Run native module tests on standalone release
|
- name: Run native module tests on standalone release
|
||||||
run: yarn test:native
|
run: yarn test:native
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build packages with nfpm
|
- name: Build packages with nfpm
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
run: yarn package
|
run: yarn package
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
|
@ -254,6 +274,23 @@ jobs:
|
||||||
name: Upload npm package
|
name: Upload npm package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
needs: npm-version
|
||||||
|
steps:
|
||||||
|
- name: Download npm package
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: npm-release-package
|
||||||
|
|
||||||
|
- uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
discussion_category_name: "📣 Announcements"
|
||||||
|
files: ./package.tar.gz
|
||||||
|
|
||||||
|
npm-version:
|
||||||
|
name: Modify package.json version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v2
|
||||||
|
@ -265,8 +302,32 @@ jobs:
|
||||||
check_artifacts: true
|
check_artifacts: true
|
||||||
name: npm-package
|
name: npm-package
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v1
|
- name: Decompress npm package
|
||||||
|
run: tar -xzf package.tar.gz
|
||||||
|
|
||||||
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
||||||
|
# i.e. v4.9.1 -> 4.9.1
|
||||||
|
- name: Get and set VERSION
|
||||||
|
run: |
|
||||||
|
TAG="${{ inputs.version || github.ref_name }}"
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Modify version
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION )}}
|
||||||
|
run: |
|
||||||
|
echo "Updating version in root package.json"
|
||||||
|
npm version --prefix release "$VERSION"
|
||||||
|
|
||||||
|
echo "Updating version in lib/vscode/product.json"
|
||||||
|
tmp=$(mktemp)
|
||||||
|
jq '.codeServerVersion = "$VERSION"' release/lib/vscode/product.json > "$tmp" && mv "$tmp" release/lib/vscode/product.json
|
||||||
|
|
||||||
|
- name: Compress release package
|
||||||
|
run: tar -czf package.tar.gz release
|
||||||
|
|
||||||
|
- name: Upload npm package artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
draft: true
|
name: npm-release-package
|
||||||
discussion_category_name: "📣 Announcements"
|
path: ./package.tar.gz
|
||||||
files: ./package.tar.gz
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ platform: "linux"
|
||||||
version: "v${VERSION}"
|
version: "v${VERSION}"
|
||||||
section: "devel"
|
section: "devel"
|
||||||
priority: "optional"
|
priority: "optional"
|
||||||
maintainer: "Anmol Sethi <hi@nhooyr.io>"
|
maintainer: "Joe Previte <joe@coder.com>"
|
||||||
description: |
|
description: |
|
||||||
Run VS Code in the browser.
|
Run VS Code in the browser.
|
||||||
vendor: "Coder"
|
vendor: "Coder"
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Description: This is a script to make the release process easier
|
|
||||||
# Run it with `yarn release:prep` and it will do the following:
|
|
||||||
# 1. Check that you have gh installed and that you're signed in
|
|
||||||
# 2. Update the version of code-server (package.json, docs, etc.)
|
|
||||||
# 3. Update the code coverage badge in the README
|
|
||||||
# 4. Open a draft PR using the release_template.md and view in browser
|
|
||||||
# If you want to perform a dry run of this script run DRY_RUN=1 yarn release:prep
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
CHECKMARK="\xE2\x9C\x94"
|
|
||||||
DASH="-"
|
|
||||||
|
|
||||||
main() {
|
|
||||||
if [ "${DRY_RUN-}" = 1 ]; then
|
|
||||||
echo "Performing a dry run..."
|
|
||||||
CMD="echo"
|
|
||||||
else
|
|
||||||
CMD=''
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$(dirname "$0")/../.."
|
|
||||||
|
|
||||||
# Check that gh is installed
|
|
||||||
if ! command -v gh &> /dev/null; then
|
|
||||||
echo "gh could not be found."
|
|
||||||
echo "We use this with the release-github-draft.sh and release-github-assets.sh scripts."
|
|
||||||
echo -e "See docs here: https://github.com/cli/cli#installation"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that they have jq installed
|
|
||||||
if ! command -v jq &> /dev/null; then
|
|
||||||
echo "jq could not be found."
|
|
||||||
echo "We use this to parse the package.json and grab the current version of code-server."
|
|
||||||
echo -e "See docs here: https://stedolan.github.io/jq/download/"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that they have rg installed
|
|
||||||
if ! command -v rg &> /dev/null; then
|
|
||||||
echo "rg could not be found."
|
|
||||||
echo "We use this when updating files across the codebase."
|
|
||||||
echo -e "See docs here: https://github.com/BurntSushi/ripgrep#installation"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that they have node installed
|
|
||||||
if ! command -v node &> /dev/null; then
|
|
||||||
echo "node could not be found."
|
|
||||||
echo "That's surprising..."
|
|
||||||
echo "We use it in this script for getting the package.json version"
|
|
||||||
echo -e "See docs here: https://nodejs.org/en/download/"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that gh is authenticated
|
|
||||||
if ! gh auth status -h github.com &> /dev/null; then
|
|
||||||
echo "gh isn't authenticated to github.com."
|
|
||||||
echo "This is needed for our scripts that use gh."
|
|
||||||
echo -e "See docs regarding authentication: https://cli.github.com/manual/gh_auth_login"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Note: we need to set upstream as well or the gh pr create step will fail
|
|
||||||
# See: https://github.com/cli/cli/issues/575
|
|
||||||
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
|
|
||||||
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
|
|
||||||
echo "Doesn't look like you've pushed this branch to remote"
|
|
||||||
# Note: we need to set upstream as well or the gh pr create step will fail
|
|
||||||
# See: https://github.com/cli/cli/issues/575
|
|
||||||
echo "Please set the upstream and then run the script"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# credit to jakwuh for this solution
|
|
||||||
# https://gist.github.com/DarrenN/8c6a5b969481725a4413#gistcomment-1971123
|
|
||||||
CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version")
|
|
||||||
# Ask which version we should update to
|
|
||||||
# In the future, we'll automate this and determine the latest version automatically
|
|
||||||
echo -e "$DASH Current version: ${CODE_SERVER_CURRENT_VERSION}"
|
|
||||||
# The $'\n' adds a line break. See: https://stackoverflow.com/a/39581815/3015595
|
|
||||||
CODE_SERVER_VERSION_TO_UPDATE=$(git rev-parse --abbrev-ref HEAD | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')
|
|
||||||
echo -e "$CHECKMARK Version in branch name"
|
|
||||||
echo -e "$CHECKMARK Updating to: $CODE_SERVER_VERSION_TO_UPDATE"
|
|
||||||
|
|
||||||
$CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' -g '!lib/vscode/**' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
|
|
||||||
|
|
||||||
$CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
|
|
||||||
|
|
||||||
# This runs from the root so that's why we use this path vs. ../../
|
|
||||||
RELEASE_TEMPLATE_STRING=$(cat ./.github/PULL_REQUEST_TEMPLATE/release_template.md)
|
|
||||||
|
|
||||||
echo -e "\nOpening a draft PR on GitHub"
|
|
||||||
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
|
|
||||||
$CMD gh pr create --base main --title "release: $CODE_SERVER_VERSION_TO_UPDATE" --body "$RELEASE_TEMPLATE_STRING" --reviewer @coder/code-server --repo coder/code-server --draft --assignee "@me"
|
|
||||||
|
|
||||||
# Open PR in browser
|
|
||||||
$CMD gh pr view --web
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
|
@ -9,10 +9,6 @@ popd() {
|
||||||
builtin popd > /dev/null
|
builtin popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_json_version() {
|
|
||||||
jq -r .version package.json
|
|
||||||
}
|
|
||||||
|
|
||||||
vscode_version() {
|
vscode_version() {
|
||||||
jq -r .version lib/vscode/package.json
|
jq -r .version lib/vscode/package.json
|
||||||
}
|
}
|
||||||
|
@ -48,8 +44,6 @@ rsync() {
|
||||||
command rsync -a --del "$@"
|
command rsync -a --del "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION="$(pkg_json_version)"
|
|
||||||
export VERSION
|
|
||||||
ARCH="$(arch)"
|
ARCH="$(arch)"
|
||||||
export ARCH
|
export ARCH
|
||||||
OS=$(os)
|
OS=$(os)
|
||||||
|
|
|
@ -3,9 +3,8 @@ set -euo pipefail
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
# ci/lib.sh sets VERSION so it's available to ci/release-image/docker-bake.hcl
|
# NOTE@jsjoeio - this script assumes VERSION exists as an
|
||||||
# to push the VERSION tag.
|
# environment variable.
|
||||||
source ./ci/lib.sh
|
|
||||||
|
|
||||||
# NOTE@jsjoeio - this script assumes that you've downloaded
|
# NOTE@jsjoeio - this script assumes that you've downloaded
|
||||||
# the release-packages artifact to ./release-packages before
|
# the release-packages artifact to ./release-packages before
|
||||||
|
|
|
@ -19,12 +19,6 @@ main() {
|
||||||
# This is because npm won't publish your package unless it's a new version.
|
# This is because npm won't publish your package unless it's a new version.
|
||||||
# i.e. for development, we bump the version to <current version>-<pr number>-<commit sha>
|
# i.e. for development, we bump the version to <current version>-<pr number>-<commit sha>
|
||||||
# example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
|
# example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
|
||||||
# We need the current package.json VERSION
|
|
||||||
if ! is_env_var_set "VERSION"; then
|
|
||||||
echo "VERSION is not set. Cannot publish to npm without VERSION."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We use this to grab the PR_NUMBER
|
# We use this to grab the PR_NUMBER
|
||||||
if ! is_env_var_set "GITHUB_REF"; then
|
if ! is_env_var_set "GITHUB_REF"; then
|
||||||
echo "GITHUB_REF is not set. Are you running this locally? We rely on values provided by GitHub."
|
echo "GITHUB_REF is not set. Are you running this locally? We rely on values provided by GitHub."
|
||||||
|
@ -102,6 +96,7 @@ main() {
|
||||||
# This means the npm version will be tagged with "beta"
|
# This means the npm version will be tagged with "beta"
|
||||||
# and installed when a user runs `yarn install code-server@beta`
|
# and installed when a user runs `yarn install code-server@beta`
|
||||||
NPM_TAG="beta"
|
NPM_TAG="beta"
|
||||||
|
PACKAGE_NAME="@coder/code-server-pr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$NPM_ENVIRONMENT" == "development" ]]; then
|
if [[ "$NPM_ENVIRONMENT" == "development" ]]; then
|
||||||
|
|
|
@ -142,16 +142,16 @@ changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
|
||||||
|
|
||||||
### Publishing a release
|
### Publishing a release
|
||||||
|
|
||||||
1. Create a new branch called `release/v0.0.0` (replace 0s with actual version aka v4.5.0)
|
1. Go to GitHub Actions > Draft release > Run workflow off commit you want to
|
||||||
1. Run `yarn release:prep`
|
release. CI will automatically upload the artifacts to the release. Make sure CI
|
||||||
1. Bump chart version in `Chart.yaml`.
|
has finished on that commit.
|
||||||
1. Summarize the major changes in the `CHANGELOG.md`
|
1. CI will automatically grab the
|
||||||
1. Download CI artifacts and make sure code-server works locally.
|
|
||||||
1. Merge PR and wait for CI build on `main` to finish.
|
|
||||||
1. Go to GitHub Actions > Draft release > Run workflow off `main`. CI will automatically upload the artifacts to the release.
|
|
||||||
1. Add the release notes from the `CHANGELOG.md` and publish release. CI will automatically grab the
|
|
||||||
artifacts, publish the NPM package from `npm-package`, and publish the Docker
|
artifacts, publish the NPM package from `npm-package`, and publish the Docker
|
||||||
Hub image from `release-images`.
|
Hub image from `release-images`.
|
||||||
|
1. Publish release.
|
||||||
|
1. After, create a new branch called `release/v0.0.0` (replace 0s with actual version aka v4.5.0)
|
||||||
|
1. Summarize the major changes in the `CHANGELOG.md`
|
||||||
|
1. Bump chart version in `Chart.yaml`.
|
||||||
|
|
||||||
#### Release Candidates
|
#### Release Candidates
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "code-server",
|
"name": "code-server",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "4.8.3",
|
"version": "0.0.0",
|
||||||
"description": "Run VS Code on a remote server.",
|
"description": "Run VS Code on a remote server.",
|
||||||
"homepage": "https://github.com/coder/code-server",
|
"homepage": "https://github.com/coder/code-server",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
Loading…
Reference in New Issue