name: dotfiles
on: push

jobs:
  archlinux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Pull docker image
        run: docker-compose pull
      - name: Run Archlinux installer
        run: docker-compose up --build --exit-code-from dotfiles

      - name: Log into registry
        run: |
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login \
            docker.pkg.github.com -u ${{ github.actor }} --password-stdin

      - name: Push Docker images
        run: |
          docker push docker.pkg.github.com/${{ github.actor }}/dotfiles/dotfiles:latest
          
  osx:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - name: Cache homebrew packages
        uses: actions/cache@v2
        env:
          cache-name: cache-installed-packages
        with:
          path: |
            $HOME/Library/Caches/Homebrew
            $HOME/.pyenv
            $HOME/Library/Caches/pip
            /usr/local/Caskroom
            /usr/local/opt
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
      - name: Homebrew cleanup
        run: brew cleanup
      - name: Install Ansible
        run: brew install ansible
      - name: Install Ansible galaxies
        run: ansible-galaxy install -r requirements.yml
      - name: Run Ansible
        run: ansible-playbook -i inventory osx.yml

name: dotfiles
on: push

jobs:
  archlinux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Pull docker image
        run: docker-compose pull
      - name: Run Archlinux installer
        run: docker-compose up --build --exit-code-from dotfiles

      - name: Log into registry
        run: |
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login \
            docker.pkg.github.com -u ${{ github.actor }} --password-stdin

      - name: Push Docker images
        run: |
          docker push ${{ github.actor }}/dotfiles/archlinux-dotfiles
          
  osx:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - name: Cache homebrew packages
        uses: actions/cache@v2
        env:
          cache-name: cache-installed-packages
        with:
          path: |
            $HOME/Library/Caches/Homebrew
            $HOME/.pyenv
            $HOME/Library/Caches/pip
            /usr/local/Caskroom
            /usr/local/opt
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
      - name: Homebrew cleanup
        run: brew cleanup
      - name: Install Ansible
        run: brew install ansible
      - name: Install Ansible galaxies
        run: ansible-galaxy install -r requirements.yml
      - name: Run Ansible
        run: ansible-playbook -i inventory osx.yml

Revert "Fix: Push docker image to Github with correct tag"
Revert "Fix: Push docker image to Github with correct tag"

This reverts commit 2ba964645f9b97b9f2ca4f51fdd5122f536582c7.
