Documented the advanced settings #14
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: Artifacts | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
push: | |
branches: [ "master" ] | |
# Publish semver tags as releases. | |
tags: [ '*.*.*' ] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Determine the container tag | |
- name: Determine the container tag | |
run: | | |
if [[ "${{ github.ref }}" == refs/heads/master ]]; then | |
echo "TAG=master" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
TAG=${{ github.ref_name }} | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
fi | |
shell: bash | |
# Update the container tag in the docker-compose.yml file | |
- name: Update docker-compose.yml | |
run: | | |
sed -i "s|arcadeia:\${CONTAINER_TAG:-latest}|arcadeia:${{ env.TAG }}|g" docker-compose.yml | |
# Create an archive of artifacts | |
- name: Create artifact archive | |
run: | | |
tar -czvf arcadeia.tar.gz \ | |
start \ | |
stop \ | |
restart \ | |
logs \ | |
exec \ | |
docker-compose.yml \ | |
docker-compose-production.yml \ | |
Apache/usr/local/apache2/conf/httpd.conf \ | |
Apache/usr/local/apache2/conf/extra/vhosts/default.conf | |
# Archive the artifacts locally (for workflow use) | |
- name: Upload artifacts for workflow | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "Arcadeia (${{ github.ref_name }})" | |
path: arcadeia.tar.gz | |
# Check if the release already exists | |
- name: Check for existing release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
if gh release view ${{ github.ref_name }} --repo ${{ github.repository }} > /dev/null 2>&1; then | |
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Create a release if it doesn't exist | |
- name: Create a new release | |
if: ${{ env.RELEASE_EXISTS == 'false' && startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
gh release create ${{ github.ref_name }} \ | |
--title "${{ github.ref_name }}" \ | |
--notes "Automatically generated release for version ${{ github.ref_name }}" \ | |
--repo ${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Upload artifacts to the release | |
- name: Upload the artifacts to the release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
gh release upload ${{ github.ref_name }} arcadeia.tar.gz \ | |
--repo ${{ github.repository }} --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |