Skip to content

Commit ec82b95

Browse files
committedNov 6, 2019
Github release action workflow
1 parent 5ae205a commit ec82b95

29 files changed

+14127
-9868
lines changed
 

‎.github/workflows/docs.yaml

+76-77
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ name: Build & Deploy Docs
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
paths:
8-
- 'docs/**'
9-
- '.github/workflows/docs.yaml'
8+
- "docs/**"
9+
- ".github/workflows/docs.yaml"
1010
pull_request:
1111
branches:
12-
- master
12+
- master
1313
paths:
14-
- 'docs/**'
15-
- '.github/workflows/docs.yaml'
14+
- "docs/**"
15+
- ".github/workflows/docs.yaml"
1616

1717
env:
1818
NETLIFY_SITE_ID: "842923e2-f262-4e62-9e52-cbdcfadc6a47"
@@ -21,77 +21,76 @@ env:
2121

2222
jobs:
2323
run:
24-
2524
runs-on: ubuntu-18.04
2625

2726
steps:
28-
- uses: actions/checkout@v1
29-
- name: Use Node.js
30-
uses: actions/setup-node@v1
31-
- name: Build latest version of docs
32-
run: |
33-
cp versions.json versions.all.json
34-
LATEST_VERSION=$(node ./ci-gen-version.js)
35-
36-
npm install
37-
npm run build
38-
working-directory: ./docs/website
39-
env:
40-
NPM_CONFIG_GLOBALCONFIG: "dist/npm/etc/npmrc"
41-
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_DEVSPACE_REGISTRY_TOKEN }}
42-
- name: Deploy preview site on netlify
43-
run: |
44-
npm install -g netlify-cli
45-
netlify deploy --auth=$NETLIFY_AUTH_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR
46-
working-directory: ./docs/website
47-
- name: Merge docs pages of previous versions with current version
48-
if: github.ref == 'refs/heads/master'
49-
run: |
50-
LATEST_VERSION=$(node -e "var versions = require('./versions.all.json'); console.log(versions[0]);")
51-
PREVIOUS_VERSION=$(node -e "var versions = require('./versions.all.json'); console.log(versions[1]);")
52-
53-
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
54-
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
55-
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
56-
57-
echo $GCLOUD_DOCS_SERVICE_ACCOUNT >gcloud-sa.json
58-
gcloud auth activate-service-account --key-file=gcloud-sa.json
59-
gcloud config set project $GCLOUD_PROJECT
60-
61-
mv $OUT_DIR ${OUT_DIR}-latest
62-
mkdir -p $OUT_DIR/docs-tmp
63-
gsutil -m cp -r gs://$GCLOUD_BUCKET/* $OUT_DIR
64-
65-
mv $OUT_DIR/docs/v* $OUT_DIR/docs-tmp
66-
rm -rf $OUT_DIR/docs-tmp/$LATEST_VERSION
67-
rm -rf $OUT_DIR/docs
68-
69-
mv $OUT_DIR/docs-tmp $OUT_DIR/docs
70-
71-
CACHED_VERSION_LINKS=$(head -n 1 $OUT_DIR/versions.html | sed -E 's~^.*<h3 id="archive">.*<tbody>(.*)</tbody>.*$~\1~')
72-
PREVIOUS_VERSION_CACHED=$(echo $CACHED_VERSION_LINKS | sed -E 's~^<tr><th>([^<]*).*$~\1~')
73-
74-
if [ "$PREVIOUS_VERSION_CACHED" != "$PREVIOUS_VERSION" ]; then
75-
CACHED_VERSION_LINKS="<tr><th>$PREVIOUS_VERSION</th><td><a href="/docs/$PREVIOUS_VERSION/introduction">Documentation</a></td><td><a href="https://github.com/devspace-cloud/devspace/releases/tag/$PREVIOUS_VERSION">Release Notes</a></td></tr>$CACHED_VERSION_LINKS"
76-
fi
77-
78-
sed -Ei "s~^(.*<h3 id=\"archive\">.*<tbody>)(.*)(</tbody>.*)$~\1$CACHED_VERSION_LINKS\3~" ${OUT_DIR}-latest/versions.html
79-
80-
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/versions/index.html
81-
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/en/versions.html
82-
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/en/versions/index.html
83-
84-
cp -r ${OUT_DIR}-latest/* $OUT_DIR
85-
rm -rf $OUT_DIR/sitemap.xml
86-
87-
gsutil -m rsync -d -r -x "docs/next/.*" $OUT_DIR gs://$GCLOUD_BUCKET/
88-
working-directory: ./docs/website
89-
env:
90-
GCLOUD_DOCS_SERVICE_ACCOUNT: ${{ secrets.GCLOUD_DOCS_SERVICE_ACCOUNT }}
91-
GCLOUD_PROJECT: "devspace-docs"
92-
GCLOUD_BUCKET: "docs-site"
93-
- name: Deploy production site on netlify
94-
if: github.ref == 'refs/heads/master'
95-
run: |
96-
netlify deploy --auth=$NETLIFY_AUTH_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR --prod
97-
working-directory: ./docs/website
27+
- uses: actions/checkout@v1
28+
- name: Use Node.js
29+
uses: actions/setup-node@v1
30+
- name: Build latest version of docs
31+
run: |
32+
cp versions.json versions.all.json
33+
LATEST_VERSION=$(node ./ci-gen-version.js)
34+
35+
npm install
36+
npm run build
37+
working-directory: ./docs/website
38+
env:
39+
NPM_CONFIG_GLOBALCONFIG: "../../dist/npm/config/npmrc"
40+
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
41+
- name: Deploy preview site on netlify
42+
run: |
43+
npm install -g netlify-cli
44+
netlify deploy --auth=$NETLIFY_AUTH_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR
45+
working-directory: ./docs/website
46+
- name: Merge docs pages of previous versions with current version
47+
if: github.ref == 'refs/heads/master'
48+
run: |
49+
LATEST_VERSION=$(node -e "var versions = require('./versions.all.json'); console.log(versions[0]);")
50+
PREVIOUS_VERSION=$(node -e "var versions = require('./versions.all.json'); console.log(versions[1]);")
51+
52+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
53+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
54+
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
55+
56+
echo $GCLOUD_DOCS_SERVICE_ACCOUNT >gcloud-sa.json
57+
gcloud auth activate-service-account --key-file=gcloud-sa.json
58+
gcloud config set project $GCLOUD_PROJECT
59+
60+
mv $OUT_DIR ${OUT_DIR}-latest
61+
mkdir -p $OUT_DIR/docs-tmp
62+
gsutil -m cp -r gs://$GCLOUD_BUCKET/* $OUT_DIR
63+
64+
mv $OUT_DIR/docs/v* $OUT_DIR/docs-tmp
65+
rm -rf $OUT_DIR/docs-tmp/$LATEST_VERSION
66+
rm -rf $OUT_DIR/docs
67+
68+
mv $OUT_DIR/docs-tmp $OUT_DIR/docs
69+
70+
CACHED_VERSION_LINKS=$(head -n 1 $OUT_DIR/versions.html | sed -E 's~^.*<h3 id="archive">.*<tbody>(.*)</tbody>.*$~\1~')
71+
PREVIOUS_VERSION_CACHED=$(echo $CACHED_VERSION_LINKS | sed -E 's~^<tr><th>([^<]*).*$~\1~')
72+
73+
if [ "$PREVIOUS_VERSION_CACHED" != "$PREVIOUS_VERSION" ]; then
74+
CACHED_VERSION_LINKS="<tr><th>$PREVIOUS_VERSION</th><td><a href="/docs/$PREVIOUS_VERSION/introduction">Documentation</a></td><td><a href="https://github.com/devspace-cloud/devspace/releases/tag/$PREVIOUS_VERSION">Release Notes</a></td></tr>$CACHED_VERSION_LINKS"
75+
fi
76+
77+
sed -Ei "s~^(.*<h3 id=\"archive\">.*<tbody>)(.*)(</tbody>.*)$~\1$CACHED_VERSION_LINKS\3~" ${OUT_DIR}-latest/versions.html
78+
79+
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/versions/index.html
80+
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/en/versions.html
81+
cp ${OUT_DIR}-latest/versions.html ${OUT_DIR}-latest/en/versions/index.html
82+
83+
cp -r ${OUT_DIR}-latest/* $OUT_DIR
84+
rm -rf $OUT_DIR/sitemap.xml
85+
86+
gsutil -m rsync -d -r -x "docs/next/.*" $OUT_DIR gs://$GCLOUD_BUCKET/
87+
working-directory: ./docs/website
88+
env:
89+
GCLOUD_DOCS_SERVICE_ACCOUNT: ${{ secrets.GCLOUD_DOCS_SERVICE_ACCOUNT }}
90+
GCLOUD_PROJECT: "devspace-docs"
91+
GCLOUD_BUCKET: "docs-site"
92+
- name: Deploy production site on netlify
93+
if: github.ref == 'refs/heads/master'
94+
run: |
95+
netlify deploy --auth=$NETLIFY_AUTH_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR --prod
96+
working-directory: ./docs/website

‎.github/workflows/release.yaml

+83-34
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,98 @@
1-
name: Release CLI Version
1+
name: Test & Release CLI Version
22

33
on:
44
release:
55
types: [created]
6+
push:
7+
branches:
8+
- master
9+
paths:
10+
- "**.go"
11+
- "hack/coverage.bash"
12+
- ".github/workflows/release.yaml"
13+
pull_request:
14+
branches:
15+
- master
16+
paths:
17+
- "**.go"
18+
- "hack/coverage.bash"
19+
- ".github/workflows/release.yaml"
620

721
jobs:
22+
test:
23+
runs-on: ubuntu-18.04
24+
steps:
25+
- name: Set up Go 1.13
26+
uses: actions/setup-go@v1
27+
with:
28+
go-version: 1.13
29+
- name: Check out code into the Go module directory
30+
uses: actions/checkout@v1
31+
- name: Test
32+
run: ./hack/coverage.bash
833
release:
934
if: startsWith(github.ref, 'refs/tags/v') == true
1035
needs: test
1136
runs-on: macOS-latest
1237
steps:
13-
- name: Set up Go 1.13
14-
uses: actions/setup-go@v1
15-
with:
16-
go-version: 1.13
17-
id: go
18-
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v1
20-
- name: Compile binaries
21-
run: ./hack/build-all.bash
22-
env:
23-
ANALYTICS_TOKEN: ${{ secrets.ANALYTICS_TOKEN }}
24-
ANALYTICS_ENDPOINT_EVENT: ${{ secrets.ANALYTICS_ENDPOINT_EVENT }}
25-
ANALYTICS_ENDPOINT_USER: ${{ secrets.ANALYTICS_ENDPOINT_USER }}
26-
- name: Get the version
27-
id: version
28-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
29-
- name: Publish
30-
uses: radiusnetworks/release-asset-action@v1
31-
with:
32-
pattern: "release/*"
33-
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Set up Go 1.13
39+
uses: actions/setup-go@v1
40+
with:
41+
go-version: 1.13
42+
- name: Check out code into the Go module directory
43+
uses: actions/checkout@v1
44+
- name: Compile binaries
45+
run: ./hack/build-all.bash
46+
env:
47+
ANALYTICS_TOKEN: ${{ secrets.ANALYTICS_TOKEN }}
48+
ANALYTICS_ENDPOINT_EVENT: ${{ secrets.ANALYTICS_ENDPOINT_EVENT }}
49+
ANALYTICS_ENDPOINT_USER: ${{ secrets.ANALYTICS_ENDPOINT_USER }}
50+
- name: Publish
51+
uses: FabianKramm/release-asset-action@v1
52+
with:
53+
pattern: "release/*"
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
release-ui:
56+
if: startsWith(github.ref, 'refs/tags/v') == true
57+
needs: test
58+
runs-on: ubuntu-18.04
59+
steps:
60+
- uses: actions/checkout@v1
61+
- uses: actions/setup-node@v1
62+
with:
63+
node-version: 12
64+
registry-url: https://registry.npmjs.org/
65+
- name: Cache node modules
66+
uses: actions/cache@v1
67+
with:
68+
path: ui/node_modules
69+
key: ${{ runner.os }}-node-${{ hashFiles('../../ui/package-lock.json') }}
70+
restore-keys: |
71+
${{ runner.os }}-node-
72+
- name: Build UI
73+
env:
74+
NPM_CONFIG_GLOBALCONFIG: "../../dist/npm/config/npmrc"
75+
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
76+
run: ./hack/build-ui.bash
77+
- name: Publish
78+
uses: FabianKramm/release-asset-action@v1
79+
with:
80+
pattern: "release/*"
81+
github-token: ${{ secrets.GITHUB_TOKEN }}
3482
publish-npm:
3583
if: startsWith(github.ref, 'refs/tags/v') == true
84+
needs: test
3685
runs-on: ubuntu-18.04
3786
steps:
38-
- uses: actions/checkout@v1
39-
- uses: actions/setup-node@v1
40-
with:
41-
node-version: 12
42-
registry-url: https://registry.npmjs.org/
43-
- run: |
44-
npm ci
45-
export NPM_TAG=$(node index.js get-tag)
46-
npm publish --tag $NPM_TAG
47-
working-directory: ./dist/npm
48-
env:
49-
NODE_AUTH_TOKEN: ${{secrets.NPMJS_TOKEN}}
87+
- uses: actions/checkout@v1
88+
- uses: actions/setup-node@v1
89+
with:
90+
node-version: 12
91+
registry-url: https://registry.npmjs.org/
92+
- run: |
93+
npm ci
94+
export NPM_TAG=$(node index.js get-tag)
95+
npm publish --tag $NPM_TAG
96+
working-directory: ./dist/npm
97+
env:
98+
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}

‎.github/workflows/tests.yaml

-31
This file was deleted.

‎dist/npm/.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
src
3+
config
File renamed without changes.

‎docs/website/core/Footer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class Footer extends React.Component {
2222
}
2323

2424
render() {
25-
let chatAndAnalytics = "";
25+
let optionalComponent;
2626

2727
try {
2828
const Chat = require("@devspace/react-components").Chat;
2929
const Analytics = require("@devspace/react-components").Analytics;
3030

31-
chatAndAnalytics = (
31+
optionalComponent = (
3232
<div>
3333
<Chat />
3434
<Analytics />
@@ -88,7 +88,7 @@ class Footer extends React.Component {
8888
`}}>
8989
</script>
9090

91-
{chatAndAnalytics}
91+
{optionalComponent}
9292

9393
<noscript>
9494
<iframe

‎hack/build-all.bash

+13-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if [[ -z "${DEVSPACE_BUILD_PLATFORMS}" ]]; then
3232
fi
3333

3434
if [[ -z "${DEVSPACE_BUILD_ARCHS}" ]]; then
35-
DEVSPACE_BUILD_ARCHS="amd64 386 ppc64 ppc64le"
35+
DEVSPACE_BUILD_ARCHS="amd64 386"
3636
fi
3737

3838
mkdir -p "${DEVSPACE_ROOT}/release"
@@ -44,12 +44,20 @@ for OS in ${DEVSPACE_BUILD_PLATFORMS[@]}; do
4444
NAME="${NAME}.exe"
4545
fi
4646

47-
if [[ "${ARCH}" == "ppc64" || "${ARCH}" == "ppc64le" ]] && [[ "${OS}" != "linux" ]]; then
48-
# ppc64 and ppc64le are only supported on Linux.
47+
# Enable CGO if building for OS X on OS X; this is required for
48+
# github.com/rjeczalik/notify; see https://github.com/rjeczalik/notify/pull/182
49+
if [[ "${OS}" == "darwin" && "${BUILD_PLATFORM}" == "darwin" ]]; then
50+
CGO_ENABLED=1
51+
else
52+
CGO_ENABLED=0
53+
fi
54+
55+
if [[ "${ARCH}" == "386" && "${OS}" == "darwin" ]]; then
56+
# darwin 386 is deprecated and shouldn't be used anymore
4957
echo "Building for ${OS}/${ARCH} not supported."
5058
else
51-
echo "Building for ${OS}/${ARCH}"
52-
GOARCH=${ARCH} GOOS=${OS} ${GO_BUILD_CMD} -ldflags "${GO_BUILD_LDFLAGS}"\
59+
echo "Building for ${OS}/${ARCH} with CGO_ENABLED=${CGO_ENABLED}"
60+
GOARCH=${ARCH} GOOS=${OS} CGO_ENABLED=${CGO_ENABLED} ${GO_BUILD_CMD} -ldflags "${GO_BUILD_LDFLAGS}"\
5361
-o "${DEVSPACE_ROOT}/release/${NAME}" .
5462
shasum -a 256 "${DEVSPACE_ROOT}/release/${NAME}" > "${DEVSPACE_ROOT}/release/${NAME}".sha256
5563
fi

0 commit comments

Comments
 (0)
Please sign in to comment.