Skip to content

Commit

Permalink
added release job
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Dec 16, 2023
1 parent 2d380d6 commit 65b97c9
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 5 deletions.
67 changes: 64 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
Expand All @@ -12,6 +14,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AGW_ARTIFACT_NAME: agw-pep-custom-names-tf-modules

jobs:
tfsec:
Expand Down Expand Up @@ -43,10 +46,11 @@ jobs:
recursive: "true"
recursive-path: "modules"
git-push: "true"

build-tests:
name: Build tests
runs-on: ubuntu-latest
needs: docs
needs: tfsec
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -82,8 +86,9 @@ jobs:
context: .
file: ./tests/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWER_CASE }}/agwpepcustomnames:${{ env.MINVERVERSIONOVERRIDE }}
tags: ${{ env.REGISTRY }}/${{ env.GITHUB_REPOSITORY_LOWER_CASE }}/agw-pep-custom-names:${{ env.MINVERVERSIONOVERRIDE }}
labels: ${{ steps.meta.outputs.labels }}

artifacts:
name: Create artifacts
runs-on: ubuntu-latest
Expand All @@ -104,8 +109,64 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: agw-tests-${{ env.MINVERVERSIONOVERRIDE }}
name: ${{ env.AGW_ARTIFACT_NAME }}
path: |
./modules/
./*.tf
./*.md
release:
name: Create Release
needs: artifacts
if: github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions: write-all
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: release
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.MINVERVERSIONOVERRIDE }}
body: ${{ steps.changelog.outputs.clean_changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ github.token }}

publish:
name: Publish binaries
needs: release
permissions: write-all
if: github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v')
env:
ARTIFACT_DIR: ${{ github.workspace }}/release
PROJECT_NAME: agw-pep-custom-names
runs-on: ubuntu-latest
steps:
- name: download artifacts - ${{ env.AGW_ARTIFACT_NAME }}
uses: actions/download-artifact@v3
with:
name: ${{ env.AGW_ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.AGW_ARTIFACT_NAME }}

- name: Creating Zip
run: zip -r ${{ env.AGW_ARTIFACT_NAME }}.zip ${{ env.ARTIFACT_DIR }}/${{ env.AGW_ARTIFACT_NAME }}/*

- name: upload artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ env.AGW_ARTIFACT_NAME }}.zip
asset_name: ${{ env.AGW_ARTIFACT_NAME }}.zip
asset_content_type: application/octet-stream

2 changes: 1 addition & 1 deletion modules/onpremises_tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "azurerm_container_group" "tests" {

container {
name = "${var.contaner_group_name}-container"
image = "cmendibl3/aurora"
image = "ghcr.io/azure/agw-pep-custom-names/agw-pep-custom-names:1.0.0"
cpu = "1.0"
memory = "1.0"
commands = []
Expand Down
1 change: 1 addition & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ COPY "./tests/Aurora.Tests.csproj" .
RUN dotnet restore Aurora.Tests.csproj

COPY ./tests/ .
RUN chmod +x ./scripts/run.sh
RUN dotnet build Aurora.Tests.csproj -c Release
ENTRYPOINT ["./scripts/run.sh"]
2 changes: 1 addition & 1 deletion tests/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
dotnet test -c Release --no-build -l "trx;LogFileName=TestResults.trx"
dotnet test Aurora.Tests.csproj -c Release --no-build -l "trx;LogFileName=TestResults.trx"
cat ./TestResults/TestResults.trx
sleep 3600

0 comments on commit 65b97c9

Please sign in to comment.