mirror of
https://github.com/WeeJeWel/wg-easy.git
synced 2024-12-22 17:19:23 +08:00
add deploy
This commit is contained in:
parent
992e31add1
commit
f171e25908
48
.github/workflows/deploy.yml
vendored
Normal file
48
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
name: Build & Publish Docker Image to Docker Hub
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- testing
|
||||
- testing/**
|
||||
- staging
|
||||
- staging/**
|
||||
- production
|
||||
- production/**
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Build & Deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: benjlevesque/short-sha@v1.2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# Set environment variables
|
||||
- run: echo GH_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
- run: echo VERSION=$(cat package.json | jq -r .version) >> $GITHUB_ENV
|
||||
- run: echo DOCKER_TAGS=$(cat package.json | jq -r .docker[\"$GH_BRANCH\"].tags) >> $GITHUB_ENV
|
||||
- run: echo Branch ${{ env.GH_BRANCH }}, Tags ${{ env.DOCKER_TAGS }}
|
||||
|
||||
# Build & Publish
|
||||
- name: Build & Publish Docker Image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
build-args: SSH_KEY=${{ secrets.SSH_KEY_BASE64 }}
|
||||
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8
|
||||
tags: weejewel/pivpn-web:v${{ env.VERSION }}, weejewel/pivpn-web:${{ env.DOCKER_TAGS }}
|
@ -1,5 +1,14 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"build": "docker build --tag wg-easy ."
|
||||
},
|
||||
"docker": {
|
||||
"production": {
|
||||
"tags": "latest"
|
||||
},
|
||||
"staging": {
|
||||
"beta"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user