diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 2841a56..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Build - -on: - create: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build - id: build - uses: ./.github/actions/build - diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 0000000..58ba1a2 --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,19 @@ +name: Default + +on: + release: + push: + pull_request: + workflow_dispatch: + repository_dispatch: + +concurrency: + group: ${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + context: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/context diff --git a/.github/workflows/deploy.development.yml b/.github/workflows/deploy.development.yml deleted file mode 100644 index 06eb344..0000000 --- a/.github/workflows/deploy.development.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy (development) - -on: - pull_request: - workflow_dispatch: - -concurrency: - group: ${{ github.event_name }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - deploy: - if: ${{ github.event_name == 'workflow_dispatch' }} - runs-on: ubuntu-latest - environment: - name: development - url: https://test-github-features-development.fly.dev - steps: - - uses: actions/checkout@v2 - - id: build - uses: ./.github/actions/build - with: - push: true - username: ${{ github.actor}} - password: ${{ secrets.GITHUB_TOKEN }} - node_env: production - - - name: Deploy - uses: ./.github/actions/deploy - with: - environment: development - image: ${{ steps.build.outputs.image_version }} - fly_token: ${{ secrets.FLY_TOKEN }} diff --git a/.github/workflows/deploy.production.yml b/.github/workflows/deploy.production.yml deleted file mode 100644 index fa51020..0000000 --- a/.github/workflows/deploy.production.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy (production) - -on: - push: - branches: - - main - -concurrency: - group: ${{ github.event_name }} - cancel-in-progress: true - -jobs: - deploy: - runs-on: ubuntu-latest - environment: - name: production - url: https://test-github-features.fly.dev - steps: - - uses: actions/checkout@v2 - - id: build - uses: ./.github/actions/build - with: - push: true - username: ${{ github.actor}} - password: ${{ secrets.GITHUB_TOKEN }} - node_env: production - - - name: Deploy - uses: ./.github/actions/deploy - with: - environment: production - image: ${{ steps.build.outputs.image_version }} - fly_token: ${{ secrets.FLY_TOKEN }} diff --git a/.github/workflows/deploy.staging.yml b/.github/workflows/deploy.staging.yml deleted file mode 100644 index 5330616..0000000 --- a/.github/workflows/deploy.staging.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Deploy (staging) - -on: - merge_group: - -concurrency: - group: ${{ github.event_name }} - cancel-in-progress: true - -jobs: - deploy: - runs-on: ubuntu-latest - environment: - name: staging - url: https://test-github-features-staging.fly.dev - steps: - - uses: actions/checkout@v2 - - id: build - uses: ./.github/actions/build - with: - push: true - username: ${{ github.actor}} - password: ${{ secrets.GITHUB_TOKEN }} - node_env: production - - - name: Deploy - uses: ./.github/actions/deploy - with: - environment: staging - image: ${{ steps.build.outputs.image_version }} - fly_token: ${{ secrets.FLY_TOKEN }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml deleted file mode 100644 index 81b7af1..0000000 --- a/.github/workflows/deployment.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Deployment (notifications) - -on: - deployment_status: -jobs: - pre_deployment: - runs-on: ubuntu-latest - if: | - github.event.deployment_status.state == 'pending' || - github.event.deployment_status.state == 'in_progress' - steps: - - uses: actions/checkout@v2 - - name: Notify (attempt) - uses: ./.github/actions/slack - with: - message: "deploying ${{ github.event.deployment_status.log_url }} to ${{ github.event.deployment_status.environment }}..." - webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - - post_deploment: - runs-on: ubuntu-latest - if: | - github.event.deployment_status.state == 'success' || - github.event.deployment_status.state == 'failure' || - github.event.deployment_status.state == 'error' - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/context - - id: status - shell: bash - run: | - if [[ "${{ github.event.deployment_status.state }}" == "success" ]]; then - echo "status=success" >> $GITHUB_OUTPUT - elif [[ "${{ github.event.deployment_status.state }}" == "failure" || "${{ github.event.deployment_status.state }}" == "error" ]]; then - echo "status=failure" >> $GITHUB_OUTPUT - fi - - name: Get The PRs associated with the commit - id: prs - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - data=$(gh api graphql \ - -F owner='${{ github.repository_owner }}' \ - -F name='${{ github.event.repository.name }}' \ - -F ref='${{ github.sha }}' \ - -F query='query($name: String!, $owner: String!, $ref: GitObjectID!) { - repository(owner: $owner, name: $name) { - object(oid: $ref) { - ...on Commit { - associatedPullRequests(first: 10) { - nodes { - number - } - } - } - } - } - }') - - prs=$(echo $data | jq -r '.data.repository.object.associatedPullRequests.nodes[].number') - - echo "prs=$prs" >> $GITHUB_OUTPUT - echo "prs $prs" - echo "data $data" - - - name: Create Comment Text - id: comment - shell: bash - run: | - touch comment.txt - - environment='**${{ github.event.deployment_status.environment}}**' - environment_url='${{ github.event.deployment_status.environment_url }}' - commit_url='${{ github.server_url}}/${{ github.repository}}/commit/${{ github.sha }}' - created_at='${{ github.event.deployment_status.created_at }}' - updated_at='*${{ github.event.deployment_status.updated_at }}*' - log_url='${{ github.event.deployment_status.log_url }}' - - if [[ "${{ steps.status.outputs.status }}" == "success" ]]; then - echo ":white_check_mark: Deplyoment of <$commit_url> to ([$environment]($environment_url)) successful at $updated_at ([logs]($log_url))" >> comment.txt - elif [[ "${{ steps.status.outputs.status }}" == "failure" ]]; then - echo ":x: Deployment of <$commit_url> to ($environment) failed with status (${{ github.event.deployment_status.state }}) at $updated_at ([logs]($log_url))" >> comment.txt - fi - - { - echo 'text<> $GITHUB_OUTPUT - cat comment.txt >> $GITHUB_OUTPUT - echo EOF - } >> $GITHUB_OUTPUT - - - name: Comment PR - shell: bash - if: ${{ steps.comment.outputs.text != '' }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ -f comment.txt ]]; then - for pr in $(echo '${{ steps.prs.outputs.prs }}'); do - gh api \ - --method POST \ - -H "Accept: application/vnd.github.v3+json" \ - /repos/${{ github.repository }}/pulls/$pr/reviews \ - -f body='${{ steps.comment.outputs.text}}' \ - -F event=COMMENT - done - fi - - - name: Notify in Slack - uses: ./.github/actions/slack - with: - message: '${{ steps.comment.outputs.text }}' - webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - - diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml deleted file mode 100644 index bbd07fd..0000000 --- a/.github/workflows/issue.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Issues - -on: - issues: - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/context \ No newline at end of file diff --git a/.github/workflows/ping.yml b/.github/workflows/ping.yml deleted file mode 100644 index 5f126da..0000000 --- a/.github/workflows/ping.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Ping slack - -on: - workflow_dispatch: - -jobs: - ping: - runs-on: ubuntu-latest - steps: - - uses: ./.github/actions/slack - with: - message: 'Hello from GitHub Actions! :tada:' - webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 9773549..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - inputs: - node_env: - description: 'Node environment' - required: true - default: 'production' - -permissions: - contents: read - packages: write - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build - id: build - uses: ./.github/actions/build - with: - push: true - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - node_env: ${{ inputs.node_env }} - - name: Notify (success) - if: success() - uses: ./.github/actions/slack - with: - message: "Image built and pushed to https://github.com/mozilla/test-github-features/pkgs/container/test-github-features ${{ steps.build.outputs.tags }}" - webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - - name: Notify (failure) - if: failure() - uses: ./.github/actions/slack - with: - message: "Image build failed for ${{ github.repositoryUrl}}/runs/${{ github.run_number }}" - webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 18b17d9..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release - -on: - release: - types: [published] - -defaults: - run: - shell: bash - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - name: Context (github) - run: | - cat <