-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #797 from NetrunnerDB/docker-cd
Merge docker workflow to main branch to be able to test
- Loading branch information
Showing
3 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ name: CI | |
# This action works with pull requests and pushes | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
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 with run id | ||
run: | ||
docker tag nsgcr/netrunner-cards-json \ | ||
registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} | ||
|
||
- name: Tag image with latest | ||
run: | ||
docker tag nsgcr/netrunner-cards-json \ | ||
registry.digitalocean.com/nsgcr/netrunner-cards-json:latest | ||
|
||
- name: Push run id tag to DO Container Registry | ||
run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} | ||
|
||
- name: Push latest tag to DO Container Registry | ||
run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:3.19 | ||
|
||
COPY ./v2/ /netrunner-cards-json/v2/ | ||
COPY ./translations/ /netrunner-cards-json/translations/ | ||
COPY ./pack/ /netrunner-cards-json/pack/ | ||
COPY ./cycles.json ./factions.json ./mwl.json ./packs.json ./prebuilts.json ./rotations.json ./sides.json ./types.json /netrunner-cards-json/ | ||
|
||
ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /netrunner-cards-json/* /mnt/netrunner-cards-json/ && exit"] |