Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge docker workflow to main branch to be able to test #797

Merged
merged 7 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: CI
# This action works with pull requests and pushes
on:
pull_request:
push:
branches:
- main

env:
# We do not need Husky hooks installed for this workflow.
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/docker-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: docker-cicd

on:
push:
branches:
- main

env:
# We do not need Husky hooks installed for this workflow.
HUSKY: 0

jobs:
format_and_lint_and_test:
name: Format, Lint, Test
runs-on: ubuntu-latest
steps:

- name: Checkout the repo
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "18.x"

- name: Install dependencies
run: npm install

- name: Format Check
run: npm run format-check

- name: Lint
run: npm run lint

- name: Test
run: npm run test

build_and_push:
name: Docker build and push
needs: format_and_lint_and_test
runs-on: ubuntu-latest
steps:

- name: Checkout the repo
uses: actions/checkout@v2

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

- name: Build image
run: docker build -t nsgcr/netrunner-cards-json .

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600

- name: Tag image
run:
docker tag nsgcr/netrunner-cards-json \
registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }}
leukosaima marked this conversation as resolved.
Show resolved Hide resolved

- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:3.19

COPY . /repocontents/
leukosaima marked this conversation as resolved.
Show resolved Hide resolved
leukosaima marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /repocontents/* /mnt/netrunner-cards-json/ && exit"]
Loading