Skip to content

Commit

Permalink
Merge branch 'release/0_1_3'
Browse files Browse the repository at this point in the history
  • Loading branch information
killmenot committed Apr 18, 2024
2 parents c9d8b53 + 5cacc02 commit e47afd8
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Items that don't need to be in a Docker image.
# Anything not used by the build system should go here.
.*
Dockerfile
README.md

# Artifacts that will be built during image creation.
# This should contain all files created during `npm run build`.
node_modules
53 changes: 53 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy

on:
release:
types: [prereleased, released]

concurrency:
cancel-in-progress: false

env:
ENVIRONMENT: ${{ github.event.action == 'prereleased' && 'staging' || 'production' }}

jobs:
build-and-push:
name: "Build and push docker image"
runs-on: ubuntu-latest
environment: ${{ env.ENVIRONMENT }}
steps:
- name: Print variables
run: echo "${{ toJSON(vars)}}"

- name: Print env
run: echo "${{ toJSON(env)}}"

- name: Print secrets
run: echo "${{ toJSON(secrets)}}"

- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image (environment)
run: |
docker build -t ghcr.io/killmenot/github-test-${{ env.ENVIRONMENT }}:${{ github.event.release.tag_name }} -f Dockerfile .
- name: Push docker image to GitHub Container Registry (environment)
run: |
docker push ghcr.io/killmenot/github-test-${{ env.ENVIRONMENT }}:${{ github.event.release.tag_name }}
- name: Push docker image to GitHub Container Registry (production > staging)
if: env.ENVIRONMENT == 'production'
run: |
docker push ghcr.io/killmenot/github-test-staging:${{ github.event.release.tag_name }}
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Test

on: [push, pull_request, release]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Print github context
run: echo '${{ toJSON(github) }}'
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM nginx:1.25.4-alpine

COPY /static /usr/share/nginx/html
RUN chown nginx.nginx /usr/share/nginx/html/ -R

EXPOSE 80
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ meet you and you may call me V.
- feature2
- hotfix1
- feature3
- feature4
- feature5
- feature6
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const test = (r) => r.test.bind(r);
module.exports = {
defaultIgnores: false,
extends: ['@commitlint/config-conventional'],
ignores: [test(/Merge branch (.*?)(in|into) (.*)/)],
ignores: [test(/Merge branch (.*?)/), test(/Merge branch (.*?)(in|into) (.*)/)],
};
2 changes: 2 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Hello World</h1>
h1>

0 comments on commit e47afd8

Please sign in to comment.