From 433911b6acf49ad23178f2b0c8190bb72859f5e2 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Thu, 29 Feb 2024 17:18:14 +0200 Subject: [PATCH] Fix builds / release github actions This will mostly run all the actions on push / pr too. --- .github/workflows/build-docker.yml | 10 ++++------ .github/workflows/build.yml | 27 --------------------------- .github/workflows/release.yml | 11 +++++++++-- .github/workflows/test.yml | 2 +- tsconfig.json | 2 +- 5 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 638a279..0dafb7c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -3,9 +3,9 @@ name: Docker Build on: push: branches: - - 'master' + - "**" tags: - - "*" + - "**" jobs: docker: runs-on: ubuntu-latest @@ -14,11 +14,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - uses: aws-actions/setup-sam@v2 - with: - use-installer: true - run: npm install - - run: npm run build + - run: npx tsc - name: Docker meta id: meta uses: docker/metadata-action@v3 @@ -36,6 +33,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push latest + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') uses: docker/build-push-action@v2 with: file: Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4380bf4..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build PR - -on: - pull_request: - branches: - - '**' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18.x - - run: npm install - - run: npx tsc - - uses: aws-actions/setup-sam@v2 - with: - use-installer: true - - run: npm run build - - run: npm run build-zip - - uses: actions/upload-artifact@v3 - with: - path: lambda.zip - name: lambda - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc8a71f..6198ce3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,9 @@ name: Release on: push: tags: - - "*" + - "**" + branches: + - '**' jobs: build: @@ -21,7 +23,12 @@ jobs: - run: npm run build - run: npm run build-zip - uses: softprops/action-gh-release@v1 + if: github.event_name == 'pull_request' with: files: lambda.zip name: lambda - + - uses: actions/upload-artifact@v3 + if: github.event_name == 'push' && github.ref_type == 'tag' + with: + path: lambda.zip + name: lambda diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7debe4b..2c8ab83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: - pull_request: + push: branches: - '**' diff --git a/tsconfig.json b/tsconfig.json index 3625e9b..c6aae88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "target": "es2020", "strict": true, "preserveConstEnums": true, - "noEmit": true, "sourceMap": false, "module": "ES2022", "moduleResolution": "node", @@ -13,6 +12,7 @@ "isolatedModules": true, "types": ["node"], "resolveJsonModule": true, + "outDir": "dist" }, "exclude": ["node_modules"], "include": ["./src/**/*.ts", "./*.d.ts", "./tests/**/*.ts"],