Skip to content

Commit

Permalink
Updated builds
Browse files Browse the repository at this point in the history
  • Loading branch information
devedse committed Sep 2, 2023
1 parent 2ab8a3c commit e05cfa2
Showing 1 changed file with 47 additions and 9 deletions.
56 changes: 47 additions & 9 deletions .github/workflows/githubactionsbuilds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ on: push

jobs:
generate_version_number:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
build_number: ${{ github.ref == 'refs/heads/master' && steps.buildnumber.outputs.build_number || 1 }}
steps:
- name: Generate build number
if: github.ref == 'refs/heads/master'
id: buildnumber
uses: einaregilsson/build-number@v3
uses: onyxmueller/build-tag-number@v1
with:
token: ${{secrets.github_token}}

Expand All @@ -21,7 +23,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v2
with:
username: devedse
Expand All @@ -41,19 +42,37 @@ jobs:
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Run Buildx
- name: Set Image Tags
id: tags
run: |
export VERSION=1.0.${{needs.generate_version_number.outputs.build_number}}
VERSION=1.0.${{needs.generate_version_number.outputs.build_number}}
echo Version: $VERSION
docker buildx build -f DeveMazeGeneratorCore.Web/Dockerfile --build-arg BUILD_VERSION=$VERSION --platform linux/arm,linux/arm64,linux/amd64 -t devedse/devemazegeneratorcoreweb:${{needs.generate_version_number.outputs.build_number}} -t devedse/devemazegeneratorcoreweb:latest ${{ github.ref == 'refs/heads/master' && '--push' || '' }} .
echo github.ref: ${{ github.ref }}
echo github.actor: ${{ github.actor }}
echo branch name: ${GITHUB_REF#refs/heads/}
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
echo parsed branch name: ${BRANCH_NAME}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
if [[ "${{ github.ref }}" == 'refs/heads/master' ]]; then
echo "TAGS=-t devedse/devemazegeneratorcoreweb:${VERSION} -t devedse/devemazegeneratorcoreweb:latest" >> $GITHUB_OUTPUT
elif [[ "${{ github.actor }}" == 'dependabot[bot]' ]]; then
echo "TAGS=-t devedse/devemazegeneratorcoreweb:beta_${BRANCH_NAME}" >> $GITHUB_OUTPUT
else
echo "TAGS=-t devedse/devemazegeneratorcoreweb:beta_${BRANCH_NAME} -t devedse/devemazegeneratorcoreweb:beta_nightly" >> $GITHUB_OUTPUT
fi
- name: Run Buildx
run: |
docker buildx build -f DeveMazeGeneratorCore.Web/Dockerfile --build-arg BUILD_VERSION=${{steps.tags.outputs.version}} --platform linux/arm64,linux/amd64 ${{steps.tags.outputs.tags}} ${{ (github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && '--push' || '' }} .
build_docker_monogame_blazor:
needs: generate_version_number
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v2
with:
username: devedse
Expand All @@ -73,11 +92,30 @@ jobs:
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Run Buildx
- name: Set Image Tags
id: tags
run: |
export VERSION=1.0.${{needs.generate_version_number.outputs.build_number}}
VERSION=1.0.${{needs.generate_version_number.outputs.build_number}}
echo Version: $VERSION
docker buildx build -f DeveMazeGeneratorCore.MonoGame.Blazor/Dockerfile --build-arg BUILD_VERSION=$VERSION --platform linux/arm64,linux/amd64 -t devedse/devemazegeneratorcoremonogameblazor:${{needs.generate_version_number.outputs.build_number}} -t devedse/devemazegeneratorcoremonogameblazor:latest ${{ github.ref == 'refs/heads/master' && '--push' || '' }} .
echo github.ref: ${{ github.ref }}
echo github.actor: ${{ github.actor }}
echo branch name: ${GITHUB_REF#refs/heads/}
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
echo parsed branch name: ${BRANCH_NAME}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
if [[ "${{ github.ref }}" == 'refs/heads/master' ]]; then
echo "TAGS=-t devedse/devemazegeneratorcoremonogameblazor:${VERSION} -t devedse/devemazegeneratorcoremonogameblazor:latest" >> $GITHUB_OUTPUT
elif [[ "${{ github.actor }}" == 'dependabot[bot]' ]]; then
echo "TAGS=-t devedse/devemazegeneratorcoremonogameblazor:beta_${BRANCH_NAME}" >> $GITHUB_OUTPUT
else
echo "TAGS=-t devedse/devemazegeneratorcoremonogameblazor:beta_${BRANCH_NAME} -t devedse/devemazegeneratorcoremonogameblazor:beta_nightly" >> $GITHUB_OUTPUT
fi
- name: Run Buildx
run: |
docker buildx build -f DeveMazeGeneratorCore.MonoGame.Blazor/Dockerfile --build-arg BUILD_VERSION=${{steps.tags.outputs.version}} --platform linux/arm64,linux/amd64 ${{steps.tags.outputs.tags}} ${{ (github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && '--push' || '' }} .
build_linux:
needs: generate_version_number
Expand Down

0 comments on commit e05cfa2

Please sign in to comment.