Skip to content

#3175 Moving usings to GlobalUsing.cs (#3186) #1920

#3175 Moving usings to GlobalUsing.cs (#3186)

#3175 Moving usings to GlobalUsing.cs (#3186) #1920

# This is a basic workflow to help you get started with Actions
name: Deploy Staging
# Controls when the workflow will run
on:
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
registry_name: cgigeiotdemoacr.azurecr.io
image_name: iothub-portal
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: Build & Push Solution
# The type of runner that the job will run on
runs-on: ubuntu-latest
environment:
name: Staging
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
- name: Docker Login
# You may pin to the exact commit or the version.
uses: docker/[email protected]
with:
registry: ${{ env.registry_name }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get a latest Git tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
semver_only: true
- name: Bump the semver version up
uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: minor
- name: Remove leading v to semver
id: final-version
run: |
echo "::set-output name=new_version::$(echo ${{ steps.bump-semver.outputs.new_version }} | sed 's/^v//')"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.registry_name }}/${{ github.repository_owner }}/${{ env.image_name }}
# generate Docker tags based on the following events/attributes
tags: |
type=raw,enable=true,priority=200,prefix=,suffix=,value=${{ steps.final-version.outputs.new_version }}
flavor: |
latest=true
- name: Build and push
# You may pin to the exact commit or the version.
uses: docker/[email protected]
with:
# Build's context is the set of files located in the specified PATH or URL
context: src/
# Push is a shorthand for --output=type=registry
push: true
build-args: |
BUILD_VERSION=${{ steps.final-version.outputs.new_version }}
GITHUB_RUN_NUMBER=${{ github.run_number }}
tags:
${{ steps.meta.outputs.tags }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
environment:
name: Staging
steps:
- name: curl
uses: wei/curl@master
with:
args: -X POST "https://${{ secrets.PORTAL_DEPLOY_HOOK_USERNAME }}:${{ secrets.PORTAL_DEPLOY_HOOK_PASSWORD }}@${{ secrets.PORTAL_DEPLOY_HOOK_SCM_HOSTNAME }}/docker/hook" -H '' -d ''