Feature(ISS91): Connector version control (#94) #102
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 API | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["dev"] | |
tags: ["v*"] | |
paths: | |
- src/Adapters/Houston.API/** | |
- src/Core/** | |
- .github/workflows/deploy-api.yml | |
pull_request: | |
branches: ["dev"] | |
paths: | |
- src/Adapters/Houston.API/** | |
- src/Core/** | |
- .github/workflows/deploy-api.yml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Create testing private key | |
run: ssh-keygen -t rsa -b 4096 -m PEM -N "" -f /home/runner/work/houston/houston/src/Tests/Houston.API.UnitTests/bin/Debug/net6.0/PrivateKey.pem | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Docker Login | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1.10.0 | |
with: | |
username: ${{ secrets.REGISTRY_LOGIN }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Set image tags | |
if: github.event_name != 'pull_request' | |
id: tag | |
run: | | |
if [ "${{ startsWith(github.ref, 'refs/tags/') }}" = true ]; then | |
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
else | |
echo "::set-output name=tag::dev" | |
fi | |
- name: Build and push Docker images (DEV) | |
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/dev') | |
uses: docker/build-push-action@v2.7.0 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: jpcarpanezi/houston-api:dev | |
file: src/Adapters/Houston.API/Dockerfile | |
context: ./ | |
- name: Build and push Docker images (TAGS) | |
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') | |
uses: docker/build-push-action@v2.7.0 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
jpcarpanezi/houston-api:${{ steps.tag.outputs.tag }} | |
jpcarpanezi/houston-api:latest | |
file: src/Adapters/Houston.API/Dockerfile | |
context: ./ |