diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml new file mode 100644 index 0000000..57c12b4 --- /dev/null +++ b/.github/workflows/andrew-polk.yml @@ -0,0 +1,45 @@ +# This is your hello Github Actions file + +name: Andrew + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + pull_request: + branches: [main] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Build + run: dotnet build TestReactProject + - name: Test + run: dotnet test TestReactProject + + - name: Set Env Var + run: echo "setting env var" + env: + My_Var: ABC + - name: Read Env Var + run: echo "$My_Var" + + - name: Set Value + run: echo '::set-output name=MY_COLOR::green' + id: color-setter + - name: Read Value + run: echo "my color is ${{ steps.color-setter.outputs.MY_COLOR }}" +# Below you can see how a second job named test could be added that runs on windows and has its own steps +# test: +# runs-on: windows-latest +# +# steps: + diff --git a/README.md b/README.md index 8fe13dc..5d4229a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # gha-practice + Github action practice repository for Language Technology conference 2022 ## Setup + 1. Get Added as a contributor to this repository 1. Create a branch named after your github user (or anything you like that noone else is likely to use) 2. Do not look at the grading.yml until after the session if you can help it. @@ -12,6 +14,7 @@ Github action practice repository for Language Technology conference 2022 7. Observe how the action interacts with your PR ## Next steps - Pick from these choices, make it work, repeat + - Add a new step that runs dotnet build - Run unit tests - Add a new job @@ -19,7 +22,7 @@ Github action practice repository for Language Technology conference 2022 - Set an output variable from one step and use it in another https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs - Make your action get cancelled if you push while it is still running https://docs.github.com/en/actions/using-jobs/using-concurrency - Add a matrix and use it (build platform is an obvious use) https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs -- Publish artifacts from your GHA build +- Publish artifacts from your GHA build - Add conditions to a step https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution - Read the docs for basic understanding: https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions - Find an interesting Action on the marketplace and use it https://github.com/marketplace?type=actions