Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #68 from stakater/workflow-additions
Browse files Browse the repository at this point in the history
Added workflow files
  • Loading branch information
ahmedwaleedmalik authored Jan 19, 2021
2 parents b891035 + 43474cc commit 62dcbdc
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 34 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Pull Request

on:
pull_request:
branches:
- 'master'

env:
DOCKER_FILE_PATH: Dockerfile

jobs:
build:
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"

steps:

- name: Check out code
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

- name: Generate Tag
id: generate_tag
run: |
sha=${{ github.event.pull_request.head.sha }}
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
echo "##[set-output name=GIT_TAG;]$(echo ${tag})"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}
username: ${{ secrets.STAKATER_NEXUS_PROD_USERNAME }}
password: ${{ secrets.STAKATER_NEXUS_PROD_PASSWORD }}

- name: Generate image repository path
id: image_repository_op
run: |
echo IMAGE_REPOSITORY=$(echo ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}/${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Comment on PR
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}/${{ github.repository }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
allow-repeats: false

- name: Notify Failure
if: failure()
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
allow-repeats: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always() # Pick up events even if the job fails or is canceled.
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
100 changes: 100 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Push

on:
push:
branches:
- 'master'

env:
DOCKER_FILE_PATH: Dockerfile

jobs:
build:
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"

steps:

- name: Check out code
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

- name: Generate Tag
id: generate_tag
uses: anothrNick/github-tag-action@1.26.0
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
DRY_RUN: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}
username: ${{ secrets.STAKATER_NEXUS_PROD_USERNAME }}
password: ${{ secrets.STAKATER_NEXUS_PROD_PASSWORD }}


- name: Generate image repository path
id: image_repository_op
run: |
echo IMAGE_REPOSITORY=$(echo ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}/${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Comment on PR
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ secrets.STAKATER_NEXUS_PROD_REGISTRY }}/${{ github.repository }}:${{ steps.generate_tag.outputs.new_tag }}`'
allow-repeats: false

- name: Push Latest Tag
uses: anothrNick/github-tag-action@1.26.0
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

- name: Notify Failure
if: failure()
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
with:
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
allow-repeats: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always() # Pick up events even if the job fails or is canceled.
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest

steps:

- name: Check out code
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
# body:
draft: false
prerelease: false

- name: Notify Slack
uses: 8398a7/action-slack@v3
if: always() # Pick up events even if the job fails or is canceled.
with:
status: ${{ job.status }}
fields: repo,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM registry.access.redhat.com/ubi8/nodejs-10
FROM registry.access.redhat.com/ubi8/nodejs-12

USER root

LABEL name="Stakater Cloud Docs" \
maintainer="Stakater <hello@stakater.com" \
LABEL name="Stakater Cloud Documentation" \
maintainer="Stakater <hello@stakater.com>" \
vendor="Stakater" \
release="1" \
summary="Stakater Cloud Docs"
summary="Documentation for Stakater Cloud"

# set workdir
RUN mkdir -p $HOME/application
WORKDIR $HOME/application

# copy the entire application
COPY . .
COPY --chown=default:root . .

# install yarn globaly
RUN npm install -g yarn
Expand All @@ -22,4 +22,7 @@ RUN yarn install
# build the application
RUN yarn run build

# set non-root user
USER 1001

ENTRYPOINT ["yarn", "run", "serve"]
7 changes: 0 additions & 7 deletions Jenkinsfile

This file was deleted.

6 changes: 4 additions & 2 deletions deployments/kubernetes/chart/stakaterclouddocs/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ keywords:
- openshift
home: https://github.com/stakater/stakaterclouddocs
maintainers:
- name: Stakater
email: hello@stakater.com
- name: Stakater
email: hello@stakater.com
- name: Waleed Malik
email: waleed@stakater.com
4 changes: 3 additions & 1 deletion deployments/kubernetes/templates/chart/Chart.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ keywords:
home: https://github.com/stakater/stakaterclouddocs
maintainers:
- name: Stakater
email: hello@stakater.com
email: hello@stakater.com
- name: Waleed Malik
email: waleed@stakater.com
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@
},
"author": "Stakater",
"dependencies": {
"cosmiconfig": "^6.0.0",
"cosmiconfig": "^7.0.0",
"ecstatic": "^4.1.4",
"gray-matter": "^4.0.2",
"http-server": "^0.12.3",
"js-yaml": "^3.13.1",
"minimist": "^1.2.2",
"lodash": "^4.17.15",
"js-yaml": "^4.0.0",
"minimist": "^1.2.5",
"lodash": "^4.17.20",
"lodash.template": "^4.5.0",
"svgo": "^1.3.2",
"vuepress": "1.4.1"
"vuepress": "1.8.0"
},
"devDependencies": {
"@vuepress/plugin-active-header-links": "^1.4.1",
"@vuepress/plugin-active-header-links": "^1.8.0",
"@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.7",
"@vuepress/plugin-back-to-top": "1.4.1",
"@vuepress/plugin-medium-zoom": "1.4.1",
"@vuepress/theme-vue": "1.4.1",
"vuepress-plugin-container": "^2.1.3",
"remark-cli": "^8.0.0",
"remark-lint": "^7.0.0",
"remark-preset-lint-consistent": "^3.0.0",
"remark-preset-lint-recommended": "^4.0.0",
"textlint": "^11.6.3",
"@vuepress/plugin-back-to-top": "1.8.0",
"@vuepress/plugin-medium-zoom": "1.8.0",
"@vuepress/theme-vue": "1.8.0",
"vuepress-plugin-container": "^2.1.5",
"remark-cli": "^9.0.0",
"remark-lint": "^8.0.0",
"remark-preset-lint-consistent": "^4.0.0",
"remark-preset-lint-recommended": "^5.0.0",
"textlint": "^11.7.7",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-apostrophe": "^2.0.0",
"textlint-rule-common-misspellings": "^1.0.1",
"textlint-rule-diacritics": "^1.0.0",
"textlint-rule-en-capitalization": "^2.0.2",
"textlint-rule-stop-words": "^2.0.3",
"textlint-rule-en-capitalization": "^2.0.3",
"textlint-rule-stop-words": "^2.0.9",
"textlint-rule-terminology": "^2.1.4",
"textlint-rule-write-good": "^1.6.2",
"vue-toasted": "^1.1.28"
Expand Down

0 comments on commit 62dcbdc

Please sign in to comment.