Initialize the website #1
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: test | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
if: ${{ startsWith(github.ref, 'refs/heads/deployment/') || github.ref == 'refs/heads/main' }} | |
runs-on: [self-hosted] | |
steps: | |
- name: chceck code | |
uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm run build | |
- 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: Build and push | |
run: | | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker build -t gitdatateam/datapanda:${{ steps.version.outputs.version }} . | |
docker push gitdatateam/datapanda:${{ steps.version.outputs.version }} | |
docker tag gitdatateam/datapanda:${{ steps.version.outputs.version }} gitdatateam/datapanda:latest | |
docker push gitdatateam/datapanda:latest | |
- name: Deploy | |
uses: WyriHaximus/github-action-helm3@v3 | |
with: | |
exec: /usr/sbin/helm upgrade datapanda --install ./chart --namespace gitdata --set-string tag=latest | |
kubeconfig: ${{ secrets.KUBECONTENT }} | |
overrule_existing_kubeconfig: "true" |