In this file you will find an example solution to the tasks. There might be other solutions as well
- Click on your profile picture on the top-left corner
- Select "Your repositories"
- Click on "New" and give a name to the repository. Make sure to create a public repository.
- Browse to your repository
- Go to the "Settings" Tab
- Select "Branches"
- In the Section "Branch protection rules" click "Add rule"
- In the "Branch name pattern" add
main
and select "Require a pull request before merging" but not "Require approvals"
-
Create a new branch
-
Create a folder
.github/workflows
-
Create a .yml with a name of your choice
-
paste the following content:
name: Demo Workflow on: pull_request jobs: Markdown-Linter: runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v4 - name: markdownlint-cli uses: avto-dev/markdown-lint@v1 with: args: '.' config: '.markdownlint.yml'
-
paste the file
.markdownlint.yml
into your main folder -
go to your newly created Branch protection rule and edit it
-
Select "Require status checks to pass before merging" and search for the job name
- Simply create an index.md file with the content of your choice
-
Add the following lines to your created
.md
file:--- title: My First Page layout: default ---
You can modify the title and layout if you want
-
Create a
Gemfile
with the following content:# Gemfile source 'https://rubygems.org' gem 'jekyll', '~> 4.2'
-
Browse to your Repository Settings and Select 'Pages'
-
At 'Build and Deployment' select the Source 'GitHub Actions'
-
Create a workflow based on the recommendation
-
Create a Pull Request and merge the changes
- After a successful run of the previously created workflow go to the "Settings" Tab
- Select "Pages"
- At "Source" select Branch:
gh-pages
and Save. - After the now triggered Actions workflow the page will be available at the shown link
-
Create another workflow file in your
.github/workflows
directory -
add the following content:
name: Build and zip Jekyll and publish it to GitHub packages on: push: tags: - '*' jobs: publish-zip: runs-on: ubuntu-latest steps: - name: Ckechout git repo uses: actions/checkout@v4 - name: Build uses: jerryjvl/jekyll-build-action@v1 - name: Create .zip File uses: TheDoctor0/zip-release@0.7.1 with: path: './_site/*' - name: Upload Artifact uses: ncipollo/release-action@v1 with: artifacts: "release.zip" token: ${{ secrets.GITHUB_TOKEN }}
-
Create a tag using the following commands:
git tag -a v1.0 git push origin v1.0
-
Add the Account-Key provided by us as an Action-Secret in GitHub
-
Expand the
lint.yml
workflow with an additional job with the following content:Deploy-Azure: needs: Markdown-Linter runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v4 - name: Build uses: jerryjvl/jekyll-build-action@v1 - name: Upload to blob storage uses: azure/CLI@v1 with: inlineScript: | az storage blob upload-batch --account-name <STORAGE ACCOUNT> --auth-mode key --account-key ${{ secrets.AZURE_BLOB_SECRET }} -d '$web' -s ./_site
-
Create a Pull Request