Fix docker push command #20
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
name: Planechase CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Audit | |
run: npm audit --production | |
test: | |
needs: [ audit ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install packages | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
build-image: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install packages | |
run: npm ci | |
- name: Build | |
run: npm run build:production | |
- name: Build image | |
run: docker build -t planechase:latest . | |
- name: Save image | |
run: docker save planechase:latest > planechase-image.tar | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: planechase-image | |
path: planechase-image.tar | |
retention-days: 1 | |
push-image: | |
needs: [ build-image ] | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Retrieve saved Docker image | |
uses: actions/download-artifact@v3 | |
with: | |
name: planechase-image | |
- name: Load image into docker | |
run: docker load < planechase-image.tar | |
- name: Retag image for upload | |
run: docker tag planechase:latest ghcr.io/ionaru/planechase/planechase:latest | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image | |
run: docker push ghcr.io/ionaru/planechase/planechase:latest | |
deploy: | |
needs: [ push-image ] | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Deploy | |
run: npx -q @ionaru/teamcity-deploy teamcity.saturnserver.org Planechase_Deploy ${{ secrets.TEAMCITY_TOKEN }} |