├── .github ├── ISSUE_TEMPLATE_DEPLOYMENT.md └── workflows │ ├── CICD.yml │ ├── Conditions.yml │ ├── SCMTrigger.yml │ ├── SonarScanner-Windows.yml │ ├── Upload Download Artifacts.yml │ ├── action_for_ghcr.yaml │ ├── caller_repo_dispatch.yml │ ├── compositeActionUse.yml │ ├── conditions.yml │ ├── issueOpener.yml │ ├── issueResponder.yml │ ├── logsecrets.yml │ ├── main.yml │ ├── manualtriggerinputs.yaml │ ├── publishNuGetPackage.yml │ ├── reusableWorkflowsUser.yml │ ├── ring-deploy-api-template.yaml │ ├── ring-deploy-db+api-template.yaml │ ├── ring-deploy-db-template.yaml │ ├── ring-deploy.yml │ ├── target_repo_dispatch.yml │ ├── tokenExamples.yml │ └── variable_concatenation.yml ├── Dockerfile └── README.md /.github/ISSUE_TEMPLATE_DEPLOYMENT.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Deployment Requested 3 | labels: deployment 4 | --- 5 | Version: {{ env.VERSION }} 6 | -------------------------------------------------------------------------------- /.github/workflows/CICD.yml: -------------------------------------------------------------------------------- 1 | name: CI + CD 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | Build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Compile 17 | run: echo Hello, world! 18 | 19 | DeployDev: 20 | name: Deploy to Dev 21 | if: github.event_name == 'pull_request' 22 | needs: [Build] 23 | runs-on: ubuntu-latest 24 | environment: 25 | name: Development 26 | url: 'http://dev.myapp.com' 27 | steps: 28 | - name: Deploy 29 | run: echo I am deploying! 30 | 31 | DeployStaging: 32 | name: Deploy to Staging 33 | if: github.event.ref == 'refs/heads/main' 34 | needs: [Build] 35 | runs-on: ubuntu-latest 36 | environment: 37 | name: Staging 38 | url: 'http://test.myapp.com' 39 | steps: 40 | - name: Deploy 41 | run: echo I am deploying! 42 | 43 | DeployProd: 44 | name: Deploy to Production 45 | needs: [DeployStaging] 46 | runs-on: ubuntu-latest 47 | environment: 48 | name: Production 49 | url: 'http://www.myapp.com' 50 | steps: 51 | - name: Deploy 52 | run: echo I am deploying! 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/Conditions.yml: -------------------------------------------------------------------------------- 1 | name: Equality conditions 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | arg1: 100 8 | arg2: 100 9 | 10 | jobs: 11 | run: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - name: String equality 18 | run: echo Is ok 19 | if: ${{ 'aaa' == 'aaa' }} 20 | 21 | - name: String equality case 22 | run: echo Is this case sensitive? 23 | if: ${{ 'aaa' == 'AAA' }} 24 | 25 | - name: String equality never run 26 | run: echo This won't run 27 | if: ${{ 'aaa' == 'bbb' }} 28 | 29 | - name: Numbers and vars 30 | run: echo works with vars 31 | if: ${{ env.arg1 == env.arg2 }} 32 | 33 | - name: Null never run 34 | run: echo This won't run 35 | if: ${{ null == 'bbb' }} 36 | -------------------------------------------------------------------------------- /.github/workflows/SCMTrigger.yml: -------------------------------------------------------------------------------- 1 | name: n3wt0n-SCMTrigger 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - master 7 | - main 8 | - release/pino* 9 | #schedule: 10 | #- cron: 0-29/10 * * * * 11 | #This has a time zone 12 | #- cron: 43 9-16/2 * * 1-5 #this is a comment 13 | #- cron: "*/15 * * * *" 14 | #- cron: "*/5 * * * *" 15 | 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: run command 22 | run: echo Hello 23 | 24 | - name: run command only if scheduled 25 | run: echo Hello 26 | if: ${{ github.event.schedule }} 27 | -------------------------------------------------------------------------------- /.github/workflows/SonarScanner-Windows.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to ahowcase the installation and usage of SonarQube for MSBuild on WIndows 2 | 3 | name: Sonar Scanner 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | env: 9 | SONARSCANNER_RELEASE_DOWNLOADURL: https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.3.1.36242/sonar-scanner-msbuild-5.3.1.36242-net46.zip 10 | SOLUTION_PATH: PATH_OF_YOUR_SLN_FILE 11 | SONAR_HOST: URL_OF_YOUR_SONARCLOUD_OR_SONARQUBE_INSTANCE 12 | SONAR_PROJECT_KEY: xxx 13 | SONAR_PROJECT_NAME: xxx 14 | SONAR_PROJECT_VERSION: 1.2.3 15 | 16 | jobs: 17 | build: 18 | runs-on: windows-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v2 22 | 23 | - name: Download and Unzip SonarScanner 24 | run: | 25 | curl -L -o sonarscanner.zip ${{ env.SONARSCANNER_RELEASE_DOWNLOADURL }} 26 | Expand-Archive -Path .\sonarscanner.zip -DestinationPath .\SonarScanner -Verbose 27 | 28 | - name: Run SonarScanner 29 | run: | 30 | SonarScanner.MSBuild.exe begin /k:"${{ env.SONAR_PROJECT_KEY }}" /n:"{{ env.SONAR_PROJECT_NAME }} /v:"${{ env.SONAR_PROJECT_VERSION }"" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}" 31 | MSBuild.exe ${{ env.SOLUTION_PATH}} /t:Rebuild 32 | SonarScanner.MSBuild.exe end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" 33 | -------------------------------------------------------------------------------- /.github/workflows/Upload Download Artifacts.yml: -------------------------------------------------------------------------------- 1 | name: UploadDownload 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 12 | - uses: actions/checkout@v2 13 | 14 | - name: Upload Artifacts 15 | uses: actions/upload-artifact@v2 16 | with: 17 | name: my-artifact 18 | path: |- 19 | **/target/*.jar 20 | anotherfile.txt 21 | !**.log 22 | 23 | - name: Download Artifacts 24 | uses: actions/download-artifact@v2 25 | with: 26 | name: my-artifact 27 | -------------------------------------------------------------------------------- /.github/workflows/action_for_ghcr.yaml: -------------------------------------------------------------------------------- 1 | name: Docker for GHCR 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | IMAGE_NAME: MyContainerImage 8 | 9 | jobs: 10 | 11 | # Push image to GitHub Packages. 12 | # See also https://docs.docker.com/docker-hub/builds/ 13 | buildImage: 14 | name: Build Docker Image 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Build Container image 21 | run: docker build . --file Dockerfile --tag $IMAGE_NAME 22 | 23 | - name: Log into GitHub Container Registry 24 | run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin 25 | 26 | - name: Push image to GitHub Container Registry 27 | run: | 28 | IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:${{ github.run_id }} 29 | docker push $IMAGE_ID 30 | 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/caller_repo_dispatch.yml: -------------------------------------------------------------------------------- 1 | name: Call another workflow 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: Repository Dispatch 12 | uses: peter-evans/repository-dispatch@v1.1.2 13 | with: 14 | # A repo scoped GitHub Personal Access Token 15 | token: ${{ secrets.REPO_PAT }} 16 | # A custom webhook event name. 17 | event-type: MyCustomEventName 18 | # JSON payload with extra information about the webhook event that your action or worklow may use. 19 | client-payload: '{ "paramA" : 123, "boolean" : false }' 20 | -------------------------------------------------------------------------------- /.github/workflows/compositeActionUse.yml: -------------------------------------------------------------------------------- 1 | name: Use the Composite Action with Actions 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | 13 | - name: Do anything elsee 14 | run: echo Pretend to do other things 15 | 16 | # Uses the Composite Action 17 | - name: Build and Push the image 18 | uses: n3wt0n/CompositeAction@main 19 | with: 20 | registry_username: ${{secrets.REGISTRY_USERNAME}} 21 | registry_password: ${{secrets.REGISTRY_PASSWORD}} 22 | image_name: my-awesome-app 23 | tag: $GITHUB_RUN_NUMBER 24 | -------------------------------------------------------------------------------- /.github/workflows/conditions.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: Conditions 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | 14 | # Runs a single command using the runners shell 15 | - name: Run a one-line script 16 | run: echo Hello, world! 17 | 18 | # Runs a set of commands using the runners shell 19 | - name: Condition - shell 20 | run: echo This maps a Jenkins Shell Condition 21 | if: "${{ echo \"this is executed if it exists\"\ncat \"meow\" }}" 22 | -------------------------------------------------------------------------------- /.github/workflows/issueOpener.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to showcase creating an Issue 2 | 3 | name: Issue - Opener 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2.3.4 15 | 16 | - name: Create an issue 17 | # You may pin to the exact commit or the version. 18 | # uses: JasonEtco/create-an-issue@e6b4b190af80961b6462c725454e7828d0247a68 19 | uses: JasonEtco/create-an-issue@v2.4.0 20 | with: 21 | filename: .github/ISSUE_TEMPLATE_DEPLOYMENT.md 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | VERSION: ${{ github.RUN_NUMBER }} 25 | -------------------------------------------------------------------------------- /.github/workflows/issueResponder.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: Issue - Responder 4 | 5 | # Controls when the action will run. 6 | on: 7 | issues: 8 | types: [closed] 9 | 10 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 11 | jobs: 12 | # This workflow contains a single job called "build" 13 | build: 14 | # The type of runner that the job will run on 15 | runs-on: ubuntu-latest 16 | 17 | # Steps represent a sequence of tasks that will be executed as part of the job 18 | steps: 19 | 20 | #- name: Get Version 21 | # run: | 22 | # $str=(${{ github.event.issue.body }} | grep Version:) 23 | # echo "VERSION=$str" >> $GITHUB_ENV 24 | 25 | # Runs a single command using the runners shell 26 | - name: Run a one-line script 27 | if: contains(github.event.issue.labels.*.name, 'deployment') 28 | run: echo Version is ${{ github.event.issue.body }} 29 | 30 | 31 | -------------------------------------------------------------------------------- /.github/workflows/logsecrets.yml: -------------------------------------------------------------------------------- 1 | name: Try Log Secrets 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | logLevel: 7 | description: 'Log level' 8 | required: true 9 | default: 'warning' 10 | tags: 11 | description: 'Test scenario tags' 12 | 13 | 14 | 15 | 16 | jobs: 17 | log: 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Log the secret 22 | run: echo ${{ secrets.MY_SECRET}} 23 | 24 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Inactive Users 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | retrieve: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: GitHub Organization User Activity Report 12 | uses: peter-murray/inactive-users-action@v1 13 | with: 14 | token: ${{ secrets.PSATOKEN }} 15 | outputDir: ${{ github.workspace }} 16 | organization: playstudios 17 | # The number of days in the past to check for activity, this will be ignored if 'since' parameter is used. 18 | activity_days: 90 19 | 20 | - name: Upload a Build Artifact 21 | uses: actions/upload-artifact@v3.0.0 22 | with: 23 | name: Report 24 | path: ${{ github.workspace }}/organization_user_activity.csv 25 | -------------------------------------------------------------------------------- /.github/workflows/manualtriggerinputs.yaml: -------------------------------------------------------------------------------- 1 | name: Manually triggered workflow 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | name: 6 | description: 'Person to greet' 7 | required: true 8 | default: 'Mona the Octocat' 9 | home: 10 | description: 'location' 11 | required: false 12 | default: 'The Octoverse' 13 | 14 | jobs: 15 | say_hello: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - run: | 19 | echo "Hello ${{ github.event.inputs.name }}!" 20 | echo "- in ${{ github.event.inputs.home }}!" 21 | -------------------------------------------------------------------------------- /.github/workflows/publishNuGetPackage.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions and NuGet Packages 2 | 3 | name: CI 4 | 5 | on: 6 | push: 7 | branches: [ master ] 8 | pull_request: 9 | branches: [ master ] 10 | 11 | jobs: 12 | build: 13 | runs-on: windows-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - name: Setup MSBuild 19 | uses: microsoft/setup-msbuild@v1 20 | 21 | - name: Setup NuGet 22 | uses: NuGet/setup-nuget@v1.0.5 23 | 24 | - name: Restore NuGet Packages 25 | run: nuget restore IntegrationSDKs.sln 26 | 27 | - name: Build Solution 28 | run: | 29 | msbuild IntegrationSDKs.sln /p:platform="Any CPU" /p:configuration="Release" /p:OutputPath="${{github.workspace}}\BuildArtifacts" 30 | 31 | # At this point, your DLLs will be in the ${{github.workspace}}\BuildArtifacts folder 32 | # We need now to copy the nuget.exe and your nuspec file from the folder where they are into the new folder 33 | 34 | - name: Copy NuGet files 35 | run: | 36 | cd 37 | copy nuget.exe ${{github.workspace}}\BuildArtifacts 38 | copy .nuspec ${{github.workspace}}\BuildArtifacts 39 | 40 | # Now all the files you need are in that folder. Let's create the nuget package 41 | # Your .nuspec file should use "." as folder fore the files to pack (aka your DLLs) 42 | # See more info here: https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package 43 | - name: Create NuGet Package 44 | run: | 45 | cd ${{github.workspace}}\BuildArtifacts 46 | nuget pack .nuspec 47 | 48 | # Publish NuGet to GitHub Packages 49 | # More info here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry 50 | - name: Publish NuGet to GitHub Packages 51 | run: | 52 | nuget sources add -username ${{ github.repository_owner }} -password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" 53 | nuget setapikey ${{ secrets.GITHUB_TOKEN }} -Source "github" 54 | nuget push .nupkg -Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" 55 | 56 | # To consume those packages on another project in another repository: 57 | # 1) Create a PAT in GitHub with "Read Packages" scope 58 | # 2) Configure your Project in Visual Studio to use the GitHub Packages to references those DLLs (there are different ways, you can google this :D ) but be sure to use the PAT you;ve just created as a password, not your password 59 | # 3) Create a Secret in the Repo where you want to consume those packages (in this example it is called MY_PAT, and save in it the value of the PAT creted above 60 | # 4) In GitHub Actions, use this to authenticate to the Packages where you have uploaded (BEFORE THE NUGET RESTORE STEP): 61 | # - name: Authenticate to GitHub Packages 62 | # run: | 63 | # nuget sources add -username ${{ github.repository_owner }} -password ${{ secrets.MY_PAT }} --store-password-in-clear-text --name github -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" 64 | # nuget setapikey ${{ secrets.MY_PAT }} -Source "github" 65 | 66 | 67 | -------------------------------------------------------------------------------- /.github/workflows/reusableWorkflowsUser.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to showcase the use of Reusable Workflows 2 | 3 | name: Reusable Workflow user 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | do-it: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Run a one-line script 16 | run: echo Hello, world! 17 | 18 | docker: 19 | uses: n3wt0n/ReusableWorkflow/.github/workflows/buildAndPublishDockerImage.yml@main 20 | with: 21 | image_name: my-awesome-app 22 | tag: $GITHUB_RUN_NUMBER 23 | secrets: 24 | registry_username: ${{secrets.REGISTRY_USERNAME}} 25 | registry_password: ${{secrets.REGISTRY_PASSWORD}} 26 | -------------------------------------------------------------------------------- /.github/workflows/ring-deploy-api-template.yaml: -------------------------------------------------------------------------------- 1 | name: Template for API deployment 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | tenant-name: 7 | required: true 8 | type: string 9 | tenant-url: 10 | required: true 11 | type: string 12 | 13 | jobs: 14 | api-deploy: 15 | runs-on: ubuntu-latest 16 | environment: 17 | name: Ring - Production - ${{ inputs.tenant-name }} APIs 18 | url: ${{ inputs.tenant-url }} 19 | steps: 20 | - run: echo "API - ${{ inputs.tenant-name }}" 21 | name: Deploy API - ${{ env.app-suffix }} 22 | env: 23 | app-suffix: ${{ format('XXX-webapi{0}', inputs.tenant-name != 'Shared' && format('-{0}', inputs.tenant-name)) || ' ' }} 24 | 25 | - run: echo "CDN - ${{ inputs.tenant-name }}" 26 | name: Deploy CDN Api - ${{ env.app-suffix }} 27 | env: 28 | app-suffix: ${{ format('XXX-cdn{0}', inputs.tenant-name != 'Shared' && format('-{0}', inputs.tenant-name)) || ' ' }} 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/ring-deploy-db+api-template.yaml: -------------------------------------------------------------------------------- 1 | name: Template for DB+API deployment 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | tenant-name: 7 | required: true 8 | type: string 9 | tenant-url: 10 | required: true 11 | type: string 12 | 13 | jobs: 14 | db-deploy: 15 | uses: ./.github/workflows/ring-deploy-db-template.yaml 16 | with: 17 | tenant-name: ${{inputs.tenant-name}} 18 | api-deploy: 19 | uses: ./.github/workflows/ring-deploy-api-template.yaml 20 | needs: db-deploy 21 | with: 22 | tenant-name: ${{inputs.tenant-name}} 23 | tenant-url: ${{inputs.tenant-url}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /.github/workflows/ring-deploy-db-template.yaml: -------------------------------------------------------------------------------- 1 | name: Template for DB deployment 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | tenant-name: 7 | required: true 8 | type: string 9 | 10 | jobs: 11 | db-deploy: 12 | runs-on: ubuntu-latest 13 | environment: 14 | name: Ring - Production - ${{ inputs.tenant-name }} DB 15 | steps: 16 | - run: echo "DB - ${{ inputs.tenant-name }}" 17 | name: Deploy DB - ${{ inputs.tenant-name }} -------------------------------------------------------------------------------- /.github/workflows/ring-deploy.yml: -------------------------------------------------------------------------------- 1 | # RING DEPLOYMENT EXAMPLE 2 | # ==================================== 3 | # This workflow will deploy a new version of the application progressively to the production environments 4 | # 5 | # Current flow: 6 | # ------------ 7 | # deploy shared db > approval > deploy shared webapi > deploy shared cdn > approval 8 | # > deploy AA db > deploy AA webapi # > deploy AA cdn > approval > 9 | # > deploy BB db > deploy BB webapi # > deploy B cdn >... > deploy cms 10 | # 11 | # We have approval after the Shared DB deploy, but not the others 12 | # Everything else after Shared deployed “in batch” for each app 13 | # And Shared CMS as last thing 14 | 15 | name: Ring Production Deployment 16 | on: 17 | - deployment 18 | - workflow_dispatch 19 | 20 | jobs: 21 | deploy-shared-db: 22 | uses: ./.github/workflows/ring-deploy-db-template.yaml 23 | with: 24 | tenant-name: Shared 25 | 26 | deploy-shared-api: 27 | needs: deploy-shared-db 28 | uses: ./.github/workflows/ring-deploy-api-template.yaml 29 | with: 30 | tenant-name: Shared 31 | tenant-url: http://api.myapp.com 32 | 33 | deploy-AA: 34 | needs: deploy-shared-api 35 | uses: ./.github/workflows/ring-deploy-db+api-template.yaml 36 | with: 37 | tenant-name: AA 38 | tenant-url: http://aa.api.myapp.com 39 | 40 | deploy-BB: 41 | needs: deploy-AA 42 | uses: ./.github/workflows/ring-deploy-db+api-template.yaml 43 | with: 44 | tenant-name: BB 45 | tenant-url: http://bb.api.myapp.com 46 | 47 | deploy-shared-cms: 48 | runs-on: ubuntu-latest 49 | needs: deploy-BB 50 | environment: 51 | name: Ring - Production - Shared CMS 52 | url: https://myapp.com/ 53 | steps: 54 | - run: echo "CMS" 55 | name: Deploy CMS 56 | -------------------------------------------------------------------------------- /.github/workflows/target_repo_dispatch.yml: -------------------------------------------------------------------------------- 1 | name: Target for call from another workflow 2 | 3 | on: 4 | repository_dispatch: 5 | types: [MyCustomEventName] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Print client payload 13 | run: | 14 | echo 'ParamA' is ${{ github.event.client_payload.paramA }} 15 | echo 'boolean' is ${{ github.event.client_payload.boolean }} 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/tokenExamples.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to show how to use GITHUB_TOKEN 2 | 3 | name: GITHUB_TOKEN examples 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: write 10 | pull-requests: write 11 | 12 | jobs: 13 | try: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/labeler@v2 18 | with: 19 | repo-token: ${{ secrets.GITHUB_TOKEN }} 20 | 21 | - name: Create a Release 22 | id: create_release 23 | uses: actions/create-release@v1 24 | env: 25 | GITHUB_TOKEN: ${{ github.token }} 26 | with: 27 | # The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag 28 | tag_name: myTag 29 | # The name of the release. For example, `Release v1.0.1` 30 | release_name: ReleaseName 31 | draft: false 32 | prerelease: false 33 | api: 34 | runs-on: ubuntu-latest 35 | permissions: 36 | issues: write 37 | packages: 38 | steps: 39 | - name: Create issue using REST API 40 | run: | 41 | curl --request POST \ 42 | --url https://api.github.com/repos/${{ github.repository }}/issues \ 43 | --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ 44 | --header 'content-type: application/json' \ 45 | --data '{ 46 | "title": "Automated issue for commit: ${{ github.sha }}", 47 | "body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_." 48 | }' \ 49 | --fail 50 | -------------------------------------------------------------------------------- /.github/workflows/variable_concatenation.yml: -------------------------------------------------------------------------------- 1 | name: Variable concatenation 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | # Top level and job level environment variables cannot be concatenated. 7 | # Previously you could use set-env to achieve a similar result but this has been removed for security reasons. 8 | # We'll use environment files to achieve the result we want. 9 | # doc-ref: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files 10 | 11 | env: 12 | arg1: abc 13 | arg2: def 14 | # you can't now say arg3: ${{arg1}}${{arg2}} to join these 15 | arg3: $arg1$arg2 #this won't work 16 | 17 | jobs: 18 | run: 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: concatenate values to environment file 23 | run: | 24 | echo "joined=${{env.arg1}}${{env.arg2}}" >> $GITHUB_ENV 25 | - name: check environment variable is available 26 | run: | 27 | echo "${{ env.joined }}" #should return abcdef 28 | - name: check on arg 3 29 | run: | 30 | echo "${{env.arg3}}" #will return the string $arg1$arg2 instead of the concatenated value 31 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Actions Test 2 | 3 | Repository used to show different GitHub Actions Features 4 | 5 | Also used in my [YouTube video](https://youtu.be/w_37LDOy4sI): 6 | 7 | ## Video 8 | 9 | If you want to see an in-depth explanation on the Actions Environments and Approvals, check my video on YouTube: 10 | 11 | [![GitHub Actions Environments](https://img.youtube.com/vi/w_37LDOy4sI/0.jpg)](https://www.youtube.com/watch?v=w_37LDOy4sI) 12 | 13 | You can also take a look at [my blog post here](https://dev.to/n3wt0n/everything-you-need-to-know-about-github-actions-environments-9p7) 14 | --------------------------------------------------------------------------------