Add github release creation

This commit is contained in:
Anmol Sethi 2020-02-14 21:32:07 -05:00
parent 61d1af0413
commit 0d31a51eeb
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
5 changed files with 123 additions and 54 deletions

View File

@ -1,5 +1,8 @@
name: ci
on: [push, pull_request, release]
name: code
on: [push, pull_request]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
fmt:
@ -21,8 +24,6 @@ jobs:
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn fmt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
lint:
runs-on: ubuntu-latest
@ -43,8 +44,6 @@ jobs:
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn lint
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
runs-on: ubuntu-latest
@ -65,47 +64,3 @@ jobs:
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
uses: ./ci/image
with:
args: yarn && yarn vscode && ./ci/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
run: yarn && yarn vscode && ./ci/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

113
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,113 @@
name: release
on:
push:
# tags:
# - 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
uses: ./ci/image
with:
args: yarn && yarn vscode && ./ci/release.sh
env:
PACKAGE: true
- name: Get release name
id: get-release-name
run: echo "::set-output name=name::$(cd release && ls *.tar.gz)"
- name: Upload release as artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.get-release-name.outputs.name }}
path: release/${{ steps.get-release-name.outputs.name }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v2.1.0
release_name: Release v2.1.0
draft: true
- name: Upload release
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.get-release-name.outputs.name }}
asset_path: release/${{ steps.get-release-name.outputs.name }}
asset_content_type: application/gzip
- name: Copy release into release image build context
uses: ./ci/image
with:
args: cp release/${{ steps.get-release-name.outputs.name }} ci/release-image
- name: Publish codercom/code-server docker container
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: codercom/code-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
context: ci/release-image
tags: "anmol"
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
run: yarn && yarn vscode && ./ci/release.sh
env:
PACKAGE: true
- name: Get release name
id: get-release-name
run: echo "::set-output name=name::$(cd release && ls *.zip)"
- name: Upload release as artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.get-release-name.outputs.name }}
path: release/${{ steps.get-release-name.outputs.name }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v2.1.0
release_name: Release v2.1.0
draft: true
- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.get-release-name.outputs.name }}
asset_path: release/${{ steps.get-release-name.outputs.name }}
asset_content_type: application/zip

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ dist*
out*
release
node_modules
binaries

1
ci/release-image/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
code-server*.tar.gz

View File

@ -3,11 +3,10 @@ FROM debian:10
RUN apt-get update
RUN apt-get install -y curl
ARG DOWNLOAD_URL=https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz
RUN cd /tmp && curl -L "$DOWNLOAD_URL" | \
tar -xz && \
COPY code-server*.tar.gz /tmp
RUN cd /tmp && tar -xzf code-server*.tar.gz && \
cp code-server*/code-server /usr/local/bin/code-server
RUN rm -rf /tmp/*
# https://wiki.debian.org/Locale#Manually
RUN apt-get install -y locales