diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c309cbf4..6890c89c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,63 +1,9 @@ -name: Creating Release - +name: Creating release +run-name: ${{ github.actor }} creating a release on: pull_request: types: [closed] jobs: - release: - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies and build - run: npm ci && npm run build - - - name: 'Get latest release tag' - id: latest_release - run: | - current_version=`gh release list --limit 30 | grep Latest | awk '{ print $1;}'` - if [ -z "$current_version" ] - then - echo "No release found" - echo "Creating tag for firt release" - echo "version=v1.0.0" >> $GITHUB_ENV - else - echo "version=${current_version}" >> $GITHUB_ENV - fi - env: - GH_TOKEN: ${{ github.token }} - - - name: Display version - run: | - # Display the version from the environment - echo "Latest Version: ${{ env.version }}" - - - id: label - uses: zwaldowski/match-label-action@v4 - with: - allowed: major,minor,patch - default_match: none - - - uses: actions-ecosystem/action-bump-semver@v1 - if: ${{ steps.label.outputs.match != 'none' }} - id: bump-semver - with: - current_version: ${{ env.version }} - level: ${{steps.label.outputs.match}} - - - name: 'Creating Release' - if: ${{ steps.label.outputs.match != 'none' }} - run: | - gh release create ${{ steps.bump-semver.outputs.new_version }} --title " ${{ steps.bump-semver.outputs.new_version }}" --generate-notes - env: - GH_TOKEN: ${{ github.token }} - - - uses: JasonEtco/build-and-tag-action@v2 - if: ${{ steps.label.outputs.match != 'none' }} - env: - GITHUB_TOKEN: ${{ github.token }} - with: - tag_name: ${{ steps.bump-semver.outputs.new_version }} + call-release-workflow: + uses: omegapoint/cydig-reusable-workflows/.github/workflows/release.yml@main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54a489dc..af4b410e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,22 +1,94 @@ -name: Test +name: Test all actions run-name: ${{ github.actor }} is running tests permissions: - contents: write - pages: write + contents: read + pages: read id-token: write -on: [push] +on: [pull_request] jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout action - uses: actions/checkout@v3 + - name: Checkout Upload action + uses: actions/checkout@v4 + with: + path: upload-action + - name: Checkout Azure compliance action + uses: actions/checkout@v4 + with: + repository: Omegapoint/cydig-azure-compliance-action + path: azure-compliance-action + - name: Checkout compliance action + uses: actions/checkout@v4 + with: + repository: Omegapoint/cydig-compliance-action + path: compliance-action - name: Setup node uses: actions/setup-node@v3 - - name: Install dependencies - run: npm ci - - name: Run tests - run: npm run test - - name: Compile to Javascript - run: npm run build + + - name: Install upload action dependencies + run: | + cd upload-action + npm ci + - name: Install compliance action dependencies + run: | + cd compliance-action + npm ci + - name: Install azure compliance action dependencies + run: | + cd azure-compliance-action + npm ci + + - name: Run upload tests + run: | + cd upload-action + npm run test + - name: Run azure compliance tests + run : | + cd azure-compliance-action + npm run test + - name: Run compliance tests + run : | + cd compliance-action + npm run test + + - name: Build Upload action + run: | + cd upload-action + npm run build + - name: Build azure compliance action + run: | + cd azure-compliance-action + npm run build + - name: Build compliance action + run: | + cd compliance-action + npm run build + + - name: 'Az CLI login' + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID_DEV }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }} + - name: 'Run Azure Compliance Controls' + uses: ./azure-compliance-action + with: + subscription: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }} + - name: 'Run Compliance Controls' + uses: ./compliance-action + with: + cydigConfigPath: ${{ github.workspace }}/compliance-action/src/cydigconfig.json + PAT-token: ${{ secrets.MY_GITHUB_PAT }} + + - name: Set dev func URL + run: | + echo "urlUpdate=${{ secrets.ULR_UPLOAD_DEV }}" >> $GITHUB_ENV + + - name: 'Run Upload Action' + uses: ./upload-action + with: + cydigConfigPath: ${{ github.workspace }}/upload-action/src/cydigConfig.json + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }} + \ No newline at end of file diff --git a/package.json b/package.json index d986e2bb..530672c8 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,8 @@ "main": "dist/index.js", "scripts": { "build": "ncc build src/index.ts", - "buildTest": "tsc", - "test": "npm run buildTest && mocha dist/tests/", - "testScript": "npm run build && mocha dist/tests/ --reporter xunit --reporter-option output=ResultsFile.xml", + "test": "tsc && mocha dist/tests/", + "testScript": "tsc && mocha dist/tests/ --reporter xunit --reporter-option output=ResultsFile.xml", "prepare": "husky install", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --fix --ext .ts",