ci(config): move config remove #18
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- deploy/* | |
pull_request: | |
workflow_call: | |
secrets: | |
DOCKERHUB_USERNAME: | |
required: true | |
DOCKERHUB_TOKEN: | |
required: true | |
KUBECONTENT: | |
required: true | |
CONFIG: | |
required: true | |
jobs: | |
deployment: | |
if: ${{ startsWith(github.ref, 'refs/heads/deployment/') || github.ref == 'refs/heads/main' }} | |
runs-on: [self-hosted] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Get version | |
id: version | |
run: | | |
if [[ -n "$GITHUB_REF" && "$GITHUB_REF" == "refs/tags/"* ]]; then | |
echo "tag version" | |
echo "::set-output name=version::${GITHUB_REF/refs\/tags\//}" | |
else | |
echo "commit version" | |
echo "::set-output name=version::${{ github.sha }}" | |
fi | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
target: x86_64-unknown-linux-gnu | |
- name: Build binary | |
run: | | |
echo "${{ secrets.CONFIG }}" >> config.yaml | |
cargo build --workspace --release | |
- name: Build and push jzfs-api | |
run: | | |
docker build -t gitdatateam/jzfs-api:${{ steps.version.outputs.version }} . | |
docker push gitdatateam/jzfs-api:${{ steps.version.outputs.version }} | |
- name: Deploy Api Server | |
uses: WyriHaximus/github-action-helm3@v3 | |
with: | |
exec: /usr/sbin/helm upgrade jzfs-api-server --install ./charts --namespace gitdata --set-string tag=${{ steps.version.outputs.version }} | |
kubeconfig: ${{ secrets.KUBECONTENT }} | |
overrule_existing_kubeconfig: "true" | |