feat: Removed logout on demo mode #68
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: After Push 2 | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
select_type: | |
if: contains('["onuratakan"]', github.actor) | |
runs-on: ubuntu-latest | |
outputs: | |
release_type: ${{ steps.any_type.outputs.release_type }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: any_type | |
id: any_type | |
run: | | |
commit_msg=$(git log --format=oneline -n 1 $GITHUB_SHA) | |
if [[ $commit_msg == *"Changed version number with"* ]]; then | |
echo "release_type=patch" >> "$GITHUB_OUTPUT" | |
else | |
echo "Commit message does not include 'Changed version number with', [MINOR], or [MAJOR]" | |
fi | |
check: | |
needs: select_type | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print Type | |
env: | |
release_type: ${{ needs.select_type.outputs.release_type }} | |
run: echo "$release_type" | |
tagext: | |
needs: select_type | |
runs-on: ubuntu-latest | |
if: ${{ (needs.select_type.outputs.release_type == 'patch') || (needs.select_type.outputs.release_type == 'minor') || (needs.select_type.outputs.release_type == 'major')}} | |
steps: | |
- name: Set Up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_PAT }} # Will change after public release | |
fetch-depth: 0 | |
- name: Fetching Tags | |
run: git fetch --tags | |
- name: Setup git config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Sleep after tag extraction | |
run: sleep 5 | |
- name: Getting Tag | |
id: tag_extractor | |
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" | |
outputs: | |
tag: ${{ steps.tag_extractor.outputs.latest_tag }} | |
check_2: | |
if: success('tagext') | |
needs: tagext | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print Tag | |
env: | |
release_type: ${{ needs.tagext.outputs.tag }} | |
run: echo "$release_type" | |
image: | |
if: success('tagext') | |
needs: tagext | |
runs-on: x64linux | |
environment: Deploys | |
steps: | |
- name: Set Up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Checkout updated repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Adding required env vars for caching Docker build | |
uses: actions/github-script@v7 | |
env: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']) | |
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) | |
- name: Echo required env vars | |
shell: bash | |
run: | | |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL" | |
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN" | |
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Publish Docker Images | |
env: | |
VERSION: ${{ needs.tagext.outputs.tag }} | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
git fetch | |
cd .. | |
if [ -d models ]; then rm -r models; fi | |
mkdir models | |
docker buildx build --platform linux/amd64 -f Server/Dockerfile --push -t upsonic/on-prem:latest-AMD64 -t upsonic/on-prem:$VERSION-AMD64 \ | |
--cache-to type=gha,mode=max \ | |
--cache-from type=gha . | |
docker buildx build --platform linux/amd64 -f Server/Dockerfile.without_models --push -t upsonic/on-prem_without_models:latest-AMD64 -t upsonic/on-prem_without_models:$VERSION-AMD64 \ | |
--cache-to type=gha,mode=max \ | |
--cache-from type=gha . | |
image_arm: | |
if: success('tagext') | |
needs: tagext | |
runs-on: armlinux | |
environment: Deploys | |
steps: | |
- name: Set Up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Checkout updated repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Adding required env vars for caching Docker build | |
uses: actions/github-script@v7 | |
env: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']) | |
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) | |
- name: Echo required env vars | |
shell: bash | |
run: | | |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL" | |
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN" | |
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Publish Docker Images | |
env: | |
VERSION: ${{ needs.tagext.outputs.tag }} | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
git fetch | |
cd .. | |
if [ -d models ]; then rm -r models; fi | |
mkdir models | |
docker buildx build --platform linux/arm64 -f Server/Dockerfile --push -t upsonic/on-prem:latest-ARM64 -t upsonic/on-prem:$VERSION-ARM64 \ | |
--cache-to type=gha,mode=max \ | |
--cache-from type=gha . | |
docker buildx build --platform linux/arm64 -f Server/Dockerfile.without_models --push -t upsonic/on-prem_without_models:latest-ARM64 -t upsonic/on-prem_without_models:$VERSION-ARM64 \ | |
--cache-to type=gha,mode=max \ | |
--cache-from type=gha . | |
release: | |
if: success('tagext') && success('image') | |
needs: [image, image_arm, tagext] | |
runs-on: ubuntu-latest | |
environment: Release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: Upsonic ${{ needs.tagext.outputs.tag }} | |
generateReleaseNotes: true | |
tag: ${{ needs.tagext.outputs.tag }} | |