Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
668b422
ci(docker): initial version of docker build and push tags
mmpetarpeshev Oct 7, 2021
6df6e69
ci(docker): fix actions versions
mmpetarpeshev Oct 8, 2021
bac5ed5
ci(build): make push on master only
mmpetarpeshev Oct 11, 2021
8db6daf
ci(build): revert pn branch and change gh pipeline job name
mmpetarpeshev Oct 11, 2021
114cb63
ci(build): test the fixed permissions
mmpetarpeshev Oct 18, 2021
fd13a7c
ci(build): remove labels from tagging
mmpetarpeshev Oct 18, 2021
382eaef
ci(build): test pipelines
mmpetarpeshev Oct 19, 2021
7a0722c
ci(build): test pipelines -change trigger
mmpetarpeshev Oct 19, 2021
7aabee8
ci(build): test pipelines -change branch triggers
mmpetarpeshev Oct 19, 2021
8424469
fix(build): trigger pipeline
mmpetarpeshev Oct 19, 2021
02ec578
ci(build): remove cache from tests job
mmpetarpeshev Oct 19, 2021
7b300f1
ci(build): try with install
mmpetarpeshev Oct 19, 2021
23a7cb9
ci(build): test without branch in checkout action
mmpetarpeshev Oct 20, 2021
f12a9f1
ci(build): revert the config to original checkout
mmpetarpeshev Oct 20, 2021
3f28dbe
ci(build): change tests job name
mmpetarpeshev Oct 20, 2021
0e700c8
ci(build): remove test step
mmpetarpeshev Oct 20, 2021
1be6935
ci(build): staging pipeline
mmpetarpeshev Feb 24, 2022
3975aa5
ci(build): change job name in staging pipeline
mmpetarpeshev Feb 24, 2022
cd4c387
ci(build): production pipeline
mmpetarpeshev Feb 24, 2022
a1353ed
ci(build): issue templates
mmpetarpeshev Mar 17, 2022
14ef960
ci(build): fix master branch in pipelines
mmpetarpeshev Mar 17, 2022
bd7ec31
ci(build): rebase with develop
mmpetarpeshev Mar 17, 2022
b2e3773
ci(build): fix Dockerfile and web files path
mmpetarpeshev Mar 17, 2022
e4ff5ba
ci(build): update release please version
mmpetarpeshev Jun 3, 2022
e67c72a
ci(build): fix release please identation
mmpetarpeshev Jun 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions .github/workflows/main.yml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/prod-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Production Superhero Wallet Pipeline

on:
push:
branches:
- master
release:
types: [created]

env:
ENV: "prd"
APP: "superhero-wallet"

jobs:
main:
runs-on: ubuntu-latest
name: Production Pipeline
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100

- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: ""
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'

- name: Set up Docker Buildx
id: buildx
# Use the action from the master, as we've seen some inconsistencies with @v1
# Issue: https://github.com/docker/build-push-action/issues/286
uses: docker/setup-buildx-action@master
# Only worked for us with this option on �‍♂️
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx

- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Extract metadata for docker
if: |
github.event_name == 'push' ||
startsWith(github.ref, 'refs/tags/v')
id: meta
uses: docker/metadata-action@v3
with:
images: aeternity/superhero-wallet
tags: |
type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'master') }}
type=raw,value=${{ steps.release.outputs.tag_name }},enable=${{ endsWith(GitHub.ref, 'master') }}
type=ref,event=tag
type=ref,event=pr

- name: Build and push docker image
if: |
github.event_name == 'push' ||
startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
# Note the mode=max here
# More: https://github.com/moby/buildkit#--export-cache-options
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps.git
ref: prd
persist-credentials: false
fetch-depth: 0

- name: Production Deploy
if: ${{ steps.release.outputs.release_created }}
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
url-prefix: ${{ steps.release.outputs.tag_name }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: prd
140 changes: 140 additions & 0 deletions .github/workflows/staging-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Staging Superhero Wallet Pipeline

on:
pull_request:
branches: [ develop ]
types: [ opened, synchronize, closed ]

env:
PR_NUMBER: ${{ github.event.pull_request.number }}
ENV: "stg"
APP: "superhero-wallet"


jobs:
main:
name: Staging Pipeline
runs-on: ubuntu-latest
steps:
- if: github.ref != 'refs/heads/develop'
uses: actions/checkout@v2
with:
ref: develop

- uses: actions/checkout@v2
with:
fetch-depth: 100

- if: github.ref != 'refs/heads/develop'
run: git branch develop origin/develop

- name: Set up Docker Buildx
id: buildx
# Use the action from the master, as we've seen some inconsistencies with @v1
# Issue: https://github.com/docker/build-push-action/issues/286
uses: docker/setup-buildx-action@master
# Only worked for us with this option on
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx

- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Extract metadata for docker
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
id: meta
uses: docker/metadata-action@v3
with:
images: aeternity/superhero-wallet
tags: |
type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'master') }}
type=ref,event=tag
type=ref,event=pr

- name: Get commit sha on PR Sync
if: github.event_name == 'pull_request' && github.event.action == 'synchronize'
id: git-sha
shell: bash
run: |
echo "::set-output name=git-sha::$(git rev-parse --short HEAD)"

- name: Build and push docker image
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
# Note the mode=max here
# More: https://github.com/moby/buildkit#--export-cache-options
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps.git
ref: stg
persist-credentials: false
fetch-depth: 0

- name: Staging PR Sync
if: github.event_name == 'pull_request' && github.event.action == 'synchronize'
uses: aeternity/ae-github-actions/argocd-pr-sync@v4
with:
git-sha: ${{ steps.git-sha.outputs.git-sha }}
url-prefix: pr-${{ env.PR_NUMBER }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Staging deploy
if: github.event_name == 'pull_request' && github.event.action == 'opened'
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
url-prefix: pr-${{ env.PR_NUMBER }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Staging undeploy
if: github.event_name == 'pull_request' && github.event.action == 'closed' && startsWith(github.head_ref, 'release') != true
uses: aeternity/ae-github-actions/argocd-undeploy@v4
with:
url-prefix: pr-${{ env.PR_NUMBER }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Print PR url
uses: unsplash/comment-on-pr@v1.3.0
if: github.event_name == 'pull_request' && github.event.action == 'opened'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: Deployed to https://pr-${{ env.PR_NUMBER }}-${{ env.APP }}.${{ env.ENV }}.aepps.com
check_for_duplicate_msg: true

- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: stg
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests Pipeline

on:
push:
branches: [ master, feat/gh-actions-docker-build ]
tags:
- 'v*'
pull_request:
branches: [ master, develop ]

jobs:
tests:
runs-on: ubuntu-latest
env:
APP_NAME: wallet
steps:
- if: github.ref != 'refs/heads/develop'
uses: actions/checkout@v2
with:
ref: develop
- uses: actions/checkout@v2
with:
fetch-depth: 100
- if: github.ref != 'refs/heads/develop'
run: git branch develop origin/develop
- uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run lint
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM cypress/base:14.17.0 as aepp-superhero-wallet-build
WORKDIR /app
USER root
RUN apt update && apt install -y make gcc g++ python git
COPY . .
RUN npm ci
RUN npm run build

FROM nginx:1.13.7-alpine
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=aepp-superhero-wallet-build /app/dist /usr/share/nginx/html
6 changes: 6 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
server {
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
Loading