Upsert protected branches #299
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
if: github.repository == 'chris-peterson/pwsh-gitlab' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish Module to PowerShell Gallery | |
uses: pcgeek86/publish-powershell-module-action@v20 | |
id: publish-module | |
with: | |
NuGetApiKey: ${{ secrets.PS_GALLERY_KEY }} | |
environment: | |
name: PowerShell Gallery | |
url: https://www.powershellgallery.com/packages/GitlabCli | |
push: | |
env: | |
IMAGE_NAME: gitlab-cli | |
IMAGE_VERSION: ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build image | |
run: docker build . --tag $IMAGE_NAME | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
if: ${{ github.ref_name == 'main' }} | |
env: | |
IMAGE_VERSION: latest | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME | |
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_VERSION | |
docker push $IMAGE_ID:$IMAGE_VERSION |