diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..5902e3b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,36 @@ +name: Build + +on: + push: + branches: + - master + paths: + - "**.ts" + - "package.json" + - "yarn.lock" + - "tsconfig.json" + +jobs: + build: + name: Transpile Typescript + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Setup workspace + run: yarn install --frozen-lockfile + + - name: Transpile + run: yarn run build + + - name: Push changes + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git add . + git commit -m "build: Transpile" || echo "No changes to commit" + git push origin HEAD \ No newline at end of file diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 0000000..00f116c --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,57 @@ +name: Integration Test + +on: + workflow_run: + workflows: ["Build"] + types: + - completed + +env: + IMAGE_NAME: alpine:3.10.3 + +jobs: + test1: + name: Test parameters + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Pull docker image + run: docker pull ${{ env.IMAGE_NAME }} + + - uses: ./ + with: + token: ${{ secrets.GITHUB_TOKEN }} + image: ${{ env.IMAGE_NAME }} + issue_label: trivy,vulnerability,test + issue_title: Security Alert Test + issue_assignee: homoluctus + + test2: + name: Getting image name from enviroment variable + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Pull docker image + run: docker pull ${{ env.IMAGE_NAME }} + + - uses: ./ + with: + token: ${{ secrets.GITHUB_TOKEN }} + issue_label: trivy,vulnerability,test + issue_title: Security Alert Test + issue_assignee: homoluctus + + test3: + name: Not create issue + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Pull docker image + run: docker pull ${{ env.IMAGE_NAME }} + + - uses: ./ + with: + issue: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fd36d48..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release New Version - -on: - push: - tags: - - 'v*' - -jobs: - release: - name: Pre Release - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v1 - - - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - - name: Create Pre Release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: 'false' - prerelease: 'true' - - - name: Slack Notification - uses: homoluctus/slatify@master - if: always() - with: - type: ${{ job.status }} - job_name: ':rocket: *Publish new release ${{ github.ref }}*' - channel: '#develop' - url: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index f1898f6..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Test my typescript action - -on: - pull_request: - paths: - - 'src/**' - - 'dist/**' - - tsconfig.json - - package.json - - yarn.lock - -env: - IMAGE_NAME: alpine:3.10.1 - -jobs: - test1: - name: Test for with parameter - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v1 - - - name: Install dependencies - run: yarn install - - - name: Build - run: yarn run build - - - name: Pull docker image - run: docker pull alpine:3.10.3 - - - uses: ./ - with: - token: ${{ secrets.GITHUB_TOKEN }} - image: alpine:3.10.1 - issue_label: trivy,vulnerability,test - issue_title: Security Alert Test - issue_assignee: homoluctus - - - uses: homoluctus/slatify@v1.9.0 - if: always() - with: - type: ${{ job.status }} - job_name: ':ts: *test gitrivy (test1)*' - channel: '#develop' - url: ${{ secrets.SLACK_WEBHOOK }} - - test2: - name: Test for getting image name from enviroment variable - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v1 - - - name: Install dependencies - run: yarn install - - - name: Build - run: yarn run build - - - name: Pull docker image - run: docker pull alpine:3.10.3 - - - uses: ./ - with: - token: ${{ secrets.GITHUB_TOKEN }} - issue_label: trivy,vulnerability,test - issue_title: Security Alert Test - issue_assignee: homoluctus - - - uses: homoluctus/slatify@v1.9.0 - if: always() - with: - type: ${{ job.status }} - job_name: ':ts: *test gitrivy (test2)*' - channel: '#develop' - url: ${{ secrets.SLACK_WEBHOOK }} - - test3: - name: Test not to create issue - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v1 - - - name: Install dependencies - run: yarn install - - - name: Build - run: yarn run build - - - name: Pull docker image - run: docker pull alpine:3.10.3 - - - uses: ./ - with: - issue: 'false' - - - uses: homoluctus/slatify@v1.9.0 - if: always() - with: - type: ${{ job.status }} - job_name: ':ts: *test gitrivy (test3)*' - channel: '#develop' - url: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/unittest.yml b/.github/workflows/unit-test.yml similarity index 67% rename from .github/workflows/unittest.yml rename to .github/workflows/unit-test.yml index cca886a..cda1a73 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unit-test.yml @@ -4,19 +4,18 @@ on: pull_request: paths: - 'src/**' - - 'dist/**' - tsconfig.json - package.json - yarn.lock jobs: - jest: - name: Test with jest - runs-on: ubuntu-18.04 + test: + name: Unit Test + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: '12.x' diff --git a/README.md b/README.md index e082ff0..a4085d8 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,12 @@ on: jobs: scan: name: Daily Vulnerability Scan - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: Pull docker image run: docker pull sample - - uses: homoluctus/gitrivy@v1.0.0 + - uses: lazy-actions/gitrivy@master with: token: ${{ secrets.GITHUB_TOKEN }} image: sample