Skip to content

Commit

Permalink
Update GitHub actions to latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-roesch committed Sep 6, 2024
1 parent 2894b1f commit 921a505
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/roshar-map
Expand All @@ -27,45 +27,45 @@ jobs:
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
uses: docker/login-action@v1
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == github.event.repository.default_branch)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push release version
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') }}
push: ${{ github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == github.event.repository.default_branch) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push dev version
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile-dev
push: ${{ github.ref == 'refs/heads/master' }}
push: ${{ github.ref == github.event.repository.default_branch }}
tags: ghcr.io/${{ github.repository_owner }}/roshar-map:latest-dev
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build_args: |
build-args: |
PUBLIC_URL=${{ secrets.DOCKER_DEV_PUBLIC_URL }}
update-service:
runs-on: ubuntu-latest
needs: [build]

if: github.event_name == 'push' && github.ref == 'refs/heads/master' && (contains(github.event.head_commit.message, '[deploy-dev]') || contains(github.event.head_commit.message, '[deploy]'))
if: github.event_name == 'push' && github.ref == github.event.repository.default_branch && (contains(github.event.head_commit.message, '[deploy-dev]') || contains(github.event.head_commit.message, '[deploy]'))

steps:
- name: Setup SSH Keys and known_hosts
Expand Down
37 changes: 26 additions & 11 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14'

- name: Cache node modules
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -48,11 +47,27 @@ jobs:
env:
FILE_NAME: "./dist/release/CNAME"
FILE_DATA: "roshar.17thshard.com"
- name: Upload artifact
uses: actions/[email protected]
with:
path: 'dist/release'

- name: Deploy
uses: maxheld83/[email protected]
if: (github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[deploy]'))
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy)
env:
GH_PAT: ${{ secrets.GH_PAT }}
BUILD_DIR: dist/release/
deploy:
if: (github.event_name == 'push' && github.ref == github.event.repository.default_branch && contains(github.event.head_commit.message, '[deploy]'))
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy)

needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 921a505

Please sign in to comment.